In the below code i have a static method i want to access controls like gridview .But it throws object reference error.I tried like the below link :How to access page controls inside a static web method?. Pls help me to solve the issue.
[WebMethod]
public static void Grade()
{
if (HttpContext.Current != null)
{
Page page = (Page)HttpContext.Current.Handler;
GridView gd = (GridView)page.FindControl("gdgrade");//null value
DataSet ds = GradeSystem.GradeSystem();
gd.DataSource = ds.Tables[0];
gd.DataBind();
}
}