如何检查LoadViewState中是否单击了按钮?

时间:2013-10-03 05:22:25

标签: c# asp.net loadviewstate

我想检查在LoadViewState中是否单击了按钮

代码:

protected override void LoadViewState(object savedState)
{
base.LoadViewState(savedState);

//Here If (btnAddExperience_Click()  is clicked)   
{
method1();
} 
//if(btnAddVisa_Click())
{
method2();
}
}

protected void btnAddExperience_Click(sender,e)
{
  //some code
}

protected void btnAddVisa_Click(sender,e)
{
  //some code
}

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

这适用于pageload,您可以在loadviewstate中尝试

if( IsPostBack ) 
{
    // get the target of the post-back, will be the name of the control
    // that issued the post-back
    string eTarget = Request.Params["__EVENTTARGET"].ToString();
}