Visual Studio web user management events are displayed only in design mode?

Calling all Visual Studio gurus - when I work on a .ascx or .aspx file in an aC # web project, events don't appear in the property bar unless I switch to the design view from the code view. Is this the intentional functionality of Visual Studio? Both VS2005 and VS2008 seem to work this way.

And is there a way to show events in the property bar all the time?

+5
source share
3 answers

I don't know if this will be the way VS works, but yes, this is a limitation. If you notice that sometimes you click on a control and press F4 (or on the properties tab), you cannot load properties for the correct control, and then you must select it from the list.

Sigh

If you make your own user control and give it an event, this event will not appear on the properties tab when you place it on the page. You will need to fix it manually in the Page_Init event (for example, demonstrated by fallen888).

These days, I'm not worried about going to the properties tab to see the event. You can also enter the name of the event in the markup, and then write it to the code file.

+4
source

, Visual Studio. , ( ), :

"this.", intellisense .

, OnInit . :

override protected void OnInit(EventArgs e)
{
  this.Load += new System.EventHandler(this.Page_Load);
  this.myButton.Click += new System.EventHandler(this.myButton_Click);

  base.OnInit(e);
}

intellisense, "+ =", .

+2

Yes, I would like for us to have the same level of event autocomplete that we get with WPF, where you can see the name of the event in IntelliSense and make it automatically create a new stub event for you in the code behind: (

0
source

All Articles