Search code examples
javascriptasp.netdom-eventsclient-side

Complete (or semi-complete) list of asp.net control client side events?


I would prefer that my asp.net pages be a bit more user responsive, so I'm adding Javascript events events to the asp.net controls. I've found some of the more obvious events by searching around, but I'm wondering if anyone knows of a good reference source for a complete (or semi-complete) list of asp.net controls and their corresponding available client side events?

If there is some really obvious answer to this, I apologize in advance - and please point me in the right direction... :-)


Solution

  • First, you can refer to w3c html documentation to learn which events are available for html elements. Even if ASP.NET control do not support adding a client-side event handler using control properties, you can always do it in javascript (and with jQuery and ASP.NET 4 predictable client id generation it's really easy). (EDIT: as Tim Schmelter pointed out in comment, you can also use attribute collection for this purpose, for instance: Button1.Attributes.Add("onclick", "alert('hello, world')");)

    Also you can refer to MSDN and check all classes that inherit from System.Web.UI.Control.

    Also you can check out the MVC way of building web sites which is pretty different from WebForms way.