简体   繁体   中英

asp.net page's preinit event

I am new to asp.net. I have an aspx page and i have to write some code in its PreInit event. From where i find PreInit event on the page. As we double click on button to get button click event(or selecting button and select event from property pane) Plz reply me ASAP.

Man, why do you need the mouse?

If you need to write some code into PreInit just write the code:

protected virtual void OnPreInit(EventArgs e)
{
   base.OnPreInit(e);
   //your code
}

or in class constructor add a event handler for it:

...
PreInit += new EventHandler(SomeMethodName)
...

and define the event handler method

private void SomeMethodName(object sender, EventArgs e)
{
   //your code
}

And by the way, check a .Net Framework book and a Visual Studio manual.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM