Add event handler to ASP.net web control without the designer

922 views Asked by At

Is there a convenient way to add an event handler to a web control declaratively (as an attribute on the control in markup) without needing to select the control in the design view for the .aspx/.ascx? Not only would I prefer to avoid the design view, but it is incapable of showing controls properly in many otherwise completely innocuous situations.

I really wonder why the properties panel is so different depending on whether the selection of the control is in the designer view or in the source view.

1

There are 1 answers

0
Michiel van Oosterhout On BEST ANSWER

In Visual Studio 11 Developer Preview this scenario has been improved:

Creating event handlers for ASP.NET controls have gotten significantly easier in Visual Studio 11 Developer Preview. Developers no longer have to write the event handlers and hook them up manually, which saves a lot of time.

IntelliSense for all server-side events now include a value called “” which, as the name implies, will create an event handler with the right signature in the code-behind file.

enter image description here

Source: New HTML Editor feature in Visual Studio 11 Developer Preview