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
Matin MetanatPosted Feb 20, 2013, 3:34 AM
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.
Kirti DarjiPosted Sep 2, 2009, 11:57 PM
AchuthaKrishnan BatheyRaghunathPosted Sep 2, 2009, 4:08 AM
Were you able to send the GridView object via jQuery "data"? If so, can you show me the code?
Kirti DarjiPosted Aug 27, 2009, 12:26 AM
Danatas GerviPosted Aug 26, 2009, 3:04 AM
public static void BindGrid(DataGrid gridToBind, string OtherInfo)
{
}