0

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.

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
Joel Day
  • 1,917
  • 1
  • 16
  • 12
  • BTW: I am finding that the fastest way is to add the handler in code with auto-complete, then to remove the original attachment and copy the method signature for the handler into the markup. – Joel Day Feb 07 '11 at 00:37

1 Answers1

1

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

Michiel van Oosterhout
  • 22,839
  • 15
  • 90
  • 132