mouseover with web form controls

inzo21

Regular
Joined
Nov 5, 2003
Messages
74
Hello all,

I was wondering if anyone knew the appropriate syntax (if it is even possible) to create the mouseover effect using a web form button component rather than an html button component.

Also, is there any distinct advantage . disadvantage to using html or web form buttons?

thanks in advance.

inzo
 
The problem you have with what you want to do is that the code for the mouseover needs to take place on the Client. ASP.NET web controls as a class (and this is true for anything on your form) are accessed via your code behind the form (or in the single form model where all the script blocks have a tag "runat=server") which is run on the server.

You basically have no interaction with the client from the server which means any code you have in your forms will require a trip to the server to enact.

You are either going to have to find a control that is generating all of the required JavaScript to use the mouseover event or write the code yourself in the HTML portion of the form.

As to using server buttons vs html buttons - here's what MS says in the docs:

Use it when:

- You prefer an HTML-like object model.

- You are working with existing HTML pages and want to quickly add Web Forms functionality. Because HTML server controls map exactly to HTML elements, they can be supported by any HTML design environment.

- The control will also interact with client script.

Personally, I use all Web Server controls whenever I can for consistency, and only use HTML controls when I don't have a matching Web Server control like HTMLGenericControl or the Hidden HTML Server control (of course, I don't use Hidden HTML control very often as ViewState is a little more efficient I think).
 
Back
Top