Bind grid in static method
hi
I call Code behind method using jQuery using Static web Method.
in this web method call successfully
but when i bind grid view in this method
give error can not use control in static method
how can we solve problem
Regards
Kirti Darji

Danatas GerviRank #4,152 · 361 reputationPosted Aug 25, 2009, 11:04 PM EDT
public static void BindGrid(DataGrid gridToBind, string OtherInfo)
{
}
Kirti Darji23 reputationPosted Aug 26, 2009, 8:26 PM EDT
AchuthaKrishnan BatheyRaghunath2 reputationPosted Sep 2, 2009, 12:08 AM EDT
Were you able to send the GridView object via jQuery "data"? If so, can you show me the code?
Kirti Darji23 reputationPosted Sep 2, 2009, 7:57 PM EDT
Matin Metanat2 reputationPosted Feb 19, 2013, 10:34 PM EST
I have a big PROBLEM with using GRIDVIEW in Static method . (same as you in 2009
and search very very topics in some forums & sites . and found your Question that very like my question & problem .
I Found & read your explain about this problem in p2p.wrox.com , But unfortunately I cann't solve problem.
Can u help me about this ?
My CODE is :
ASPX:
And in Behind Code :
public static void OnBlur_Event_Handler_01(string emp_id, string id)
{
SqlConnection ConnectionString_02 = new SqlConnection(ConfigurationManager.ConnectionStrings["MainConnectionString"].ConnectionString);
ConnectionString_02.Open();
SqlCommand mySqlCommand_02 = new SqlCommand("Select * from Ins.Driver", ConnectionString_02);
SqlDataReader Dr_02 = mySqlCommand_02.ExecuteReader();
GridView_02.DataSource = Dr_02; ===> Erroe Occurred : "Error 33 An object reference is required for the non-static field, method, or property 'Main_Transition.GridView_02' ~\Main_Transition.aspx.cs"
GridView_02.DataBind();
ConnectionString_02.Close();
}
And A Major Note :
I'm a new & Begginer C# & ASP proggramer.
Best Regard.