How to make VS create a page_init (c#)

S

SingLu

I'm going nuts here. I'm using VS2005 and C# and would like to create a
simple page and use the page_init-event. I add a new page but can't find a
way to make VS add a eventhandler. If I dbl.click the page I get a page_load
method - but I want to see a list of possible events (including page_init).
If a select the document and look in the property-window theres no "flash"
to show me a list of events (like there is where using a control). Its so
easy in VB - how is it done in c#?

Thanks
 
C

Chris Jobson

..SingLu said:
I'm going nuts here. I'm using VS2005 and C# and would like to create a
simple page and use the page_init-event. I add a new page but can't find a
way to make VS add a eventhandler. If I dbl.click the page I get a
page_load method - but I want to see a list of possible events (including
page_init). If a select the document and look in the property-window
theres no "flash" to show me a list of events (like there is where using a
control). Its so easy in VB - how is it done in c#?

It appears that all you have to do is add an appropriately-named method
(e.g. Page_Init, Page_PreRender, etc.) with the correct signature to the
code-behind file and it will be automatically invoked. In my case I wanted
to handle PreRender and I added the method:
protected void Page_PreRender(object sender, EventArgs e)
{
...
}
and it just worked! However, it seems EXTREMELY bizarre to me that there is
no nice way to get a list of the possible events and to name the handler
whatever you like.

Chris Jobson
 

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,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top