我试图在我的静态函数上访问html控件但是我得到了complie时间错误 所以请给我解决方案
这是我的代码
[System.Web.Services.WebMethod]
public static void btnPostNote_Click(string note)
{
string borrowerId = Data.QueryString("id");
note = "";
RefreshNotes(borrowerId);
lblNoteSaved.Text = "Note Successfully Saved
}
我尝试了下面的解决方案,所以我得到了空指针异常
[System.Web.Services.WebMethod]
public static void btnPostNote_Click(string note)
{
if (HttpContext.Current != null)
{
Page page = (Page)HttpContext.Current.Handler;
Label lblNoteSaved = (Label)page.FindControl("lblNoteSaved");
string borrowerId = Data.QueryString("id");
note = "";
RefreshNotes(borrowerId);
lblNoteSaved.Text = "Note Successfully Saved";
}
}
答案 0 :(得分:0)