liaqat ali
liaqat ali

Reputation: 241

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.

Upvotes: 3

Views: 10894

Answers (2)

florin
florin

Reputation: 405

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.

Upvotes: 3

Related Questions