I m trying to access html controls on my static function but i m getting complie time error so please give me the solution
here is my code
[System.Web.Services.WebMethod]
public static void btnPostNote_Click(string note)
{
string borrowerId = Data.QueryString("id");
note = "";
RefreshNotes(borrowerId);
lblNoteSaved.Text = "Note Successfully Saved
}
and i tried the below solution so i got the null pointer exception
[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";
}
}
you can use AJAX and JQuery for that these 3 links will help you
Accessing runat="server" control id in WebMethod
http://forums.asp.net/t/1580317.aspx?Access+Server+control+in+web+method+
http://www.itorian.com/2012/07/calling-aspnet-c-method-web-method.html