Is it possible to let Visual Studio automatically create an event handler method for an UI component within the markup view?
Let's say I have
<asp:label runat="server" />
and would like to handle the OnPreRender event..
How do you create the handler method? Manually or do you switch to design view and double click the event within the properties window?
Best Answer
You can automatically create a handler method by going to your page's OnLoad or Page_Load method, and adding a handler for the event. For example, for this Label:
You would do this:
At this point IntelliSense should kick in and offer to generate an event handler for you. If you hit TAB a couple of times, you should have a new MyLabel_PreRender method.
Good luck!