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.
我对asp.net是新手。我有一个aspx页面,我必须在它的PreInit事件中编写一些代码。从页面上找到PreInit事件。当我们双击按钮获取按钮单击事件(或选择按钮并从属性窗格中选择事件)时,Plz会尽快回复我。
2 个解决方案
#1
3
Man, why do you need the mouse?
伙计,你为什么要用鼠标?
If you need to write some code into PreInit just write the code:
如果需要在PreInit中编写一些代码,只需编写以下代码:
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.
顺便说一下,看看。net框架和Visual Studio手册。
#2
0
You need to do some reading:
你需要做一些阅读:
http://msdn.microsoft.com/en-us/library/ms178472.aspx#lifecycle_events
http://msdn.microsoft.com/en-us/library/ms178472.aspx lifecycle_events
#1
3
Man, why do you need the mouse?
伙计,你为什么要用鼠标?
If you need to write some code into PreInit just write the code:
如果需要在PreInit中编写一些代码,只需编写以下代码:
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.
顺便说一下,看看。net框架和Visual Studio手册。
#2
0
You need to do some reading:
你需要做一些阅读:
http://msdn.microsoft.com/en-us/library/ms178472.aspx#lifecycle_events
http://msdn.microsoft.com/en-us/library/ms178472.aspx lifecycle_events