Page Events

S

Scott M.

In a VS 2005 ASP .NET Web Application Project (WAP), how can I see a list of
the page (web form) events (i.e. new, init, loadviewstate, load,
saveviewstate, etc.) and set up event handlers for them?
 
L

Leon Mayne

Scott M. said:
In a VS 2005 ASP .NET Web Application Project (WAP), how can I see a list
of the page (web form) events (i.e. new, init, loadviewstate, load,
saveviewstate, etc.) and set up event handlers for them?

In the code behind file, select "(FormName) Events" in the dropdown in the
top right, and all the form's events will be listed in the dropdown to the
right.
 
M

Mark Rae [MVP]

In a VS 2005 ASP .NET Web Application Project (WAP), how can I see a list
of the page (web form) events (i.e. new, init, loadviewstate, load,
saveviewstate, etc.) and set up event handlers for them?

Not quite sure what you mean about "seeing" the events...?

As for setting up event handlers for them, just start typing...

E.g. if you want a Page_Init event, just type the following into your
code-behind:

protected void Page_Init(object sender, System.EventArgs e)
{

}

and add some code...
 
L

Leon Mayne

Leon Mayne said:
In the code behind file, select "(FormName) Events" in the dropdown in the
top right, and all the form's events will be listed in the dropdown to the
right.

Looking at your other post, I see that you're using C#, not VB.NET. In that
case the above method won't work. Not sure in C#. You could look at the
object's events in the class viewer?
 
L

Leon Mayne

Mark Rae said:
Not quite sure what you mean about "seeing" the events...?

As for setting up event handlers for them, just start typing...

E.g. if you want a Page_Init event, just type the following into your
code-behind:

protected void Page_Init(object sender, System.EventArgs e)
{

}

and add some code...

I think the OP would like to see a list of events availble for an object,
e.g. if you didn't know that the Page_Init event existed then you'd have
trouble using it! In VB you can get a list of the object's events and when
you select one it will automatically create the handler for you. I can't see
similar functionality in C#. Do you know how to do this, as I'm also
interested!
 
G

grava

Looking at your other post, I see that you're using C#, not VB.NET. In
that case the above method won't work. Not sure in C#. You could look at
the object's events in the class viewer?

Just a question about this difference ... is there any reason there isn't an
"event explorer" in c# as we've got in vb.net ??

Thanks in advance.
 
J

Juan T. Llibre

With your page open in the IDE, select "Page" from the leftmost dropdown
above the code...and then select the available events from the dropdown to its right.
 
G

grava

I think the OP would like to see a list of events availble for an object,
e.g. if you didn't know that the Page_Init event existed then you'd have
trouble using it! In VB you can get a list of the object's events and when
you select one it will automatically create the handler for you. I can't
see similar functionality in C#. Do you know how to do this, as I'm also
interested!

Well, by default starting writing "this." and let the intellisense show up,
then you can search for events (you've got an icon that it's quite
self-explanatory). By default if you've got an event like "PreInit", with
autoEventWireUp you can write the code Page_PreInit, if the attribute is set
to false you have to override the method that will raise the event:

override OnPreInit()
{
base.OnPreInit();
// my code
}
 
S

Scott M.

If I type "this" in a page class, nothing happens. The only way I could do
that would be to go into an existing code block and type "this" to see the
intellisense dropdown. Then, I'd have to just know what is an event or an
overrideable event handler (which I can do). But, I was hoping for
something easier as in VB .NET, where you just select the top-left drop-down
in the code editor and then the top-right dropdown gives you the events for
the item in the left drop-down.

:(
 
S

Steven Cheng[MSFT]

Hi Scott,

Yes, for the C# asp.net designer, the page level events list does be an
existing limitation(as VB.NET IDE are developed separately from C# one). I
really suggest you to submit your comments on this to our product feedback
site:

http://connect.microsoft.com/feedback/default.aspx?SiteID=210

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
From: "Scott M." <[email protected]>
References: <[email protected]>
<[email protected]>
 
S

Scott M.

Thanks Steven, I'll do that.


Steven Cheng said:
Hi Scott,

Yes, for the C# asp.net designer, the page level events list does be an
existing limitation(as VB.NET IDE are developed separately from C# one). I
really suggest you to submit your comments on this to our product feedback
site:

http://connect.microsoft.com/feedback/default.aspx?SiteID=210

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no
rights.
 
L

Leon Mayne

Juan T. Llibre said:
With your page open in the IDE, select "Page" from the leftmost dropdown
above the code...and then select the available events from the dropdown to
its right.

Sadly doesn't work in a C# ASP.NET project :-(

Scott: When you do add the enhancement request on connect, please post the
feedback Id on this thread so we can vote for it.
 
S

Scott M.

The Feedback ID is: 322994.

I've also posted this as a new thread in both the C# and the ASP .NET NG's
to hopefully attract more attention.

-Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top