Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio web user control events only show up in design mode?

Calling all Visual Studio gurus — when I'm working on a .ascx or .aspx file in a c# web project, the events do not show up in the properties panel unless I switch into the design view from the code view. Is this an intentional functionality of Visual Studio? Both VS2005 and VS2008 seem to work this way.

And is there any way to get the events to show up in the properties panel all the time?

like image 400
Rafe Avatar asked Jan 05 '09 14:01

Rafe


1 Answers

I don't know if that's the way VS is 'intended to work, but yes that's a limitation. In case you've noticed sometimes clicking on the control and pressing F4 (or clicking on the properties tab) fails to load the properties for the correct control, and then you gotta select it from the list.

Sigh

That apart, if you make a usercontrol of your own, and give it an event, that event will not show up in the properties tab when you put it on a page. You'll have to capture it manually in the Page_Init event (like demonstrated by fallen888).

These days I don't bother with going to the properties tab to see an event. You can just as well type the event's name in the mark-up and then write it in the code-behind file.

like image 188
Cyril Gupta Avatar answered Sep 27 '22 18:09

Cyril Gupta