0
當我檢查,如果按鈕被點擊或不LoadViewStateLoadViewState中的對象引用null?
我得到這個錯誤
Object reference null
在下面的代碼,如果我點擊Add經驗按鈕時 eTarget = Request.Params["btnAddVisa"].ToString();
得到零誤差
代碼:
protected override void LoadViewState(object savedState)
{
base.LoadViewState(savedState);
if(IsPostBack)
{
eTarget = Request.Params["btnAddVisa"].ToString();
eTarget = Request.Params["btnAddExperience"].ToString();
}
if(eTarget == "Add Visa")
{
//
}
if(eTarget == "Add Experience")
{
//
}
}
protected void btnAddVisa_Click(sender,e)
{
//
}
protected void btnAddExperience_Click(sender,e)
{
//
}
任何想法?在此先感謝