I want to set colums, TemplateFied,He aderTemplate,It emTemplate with (LinkButton-Text,CommandNam e,Onclick etc)
Here I am showing my code t_name table name it is varable,I want to set
various table contains various field,Then I want generate Dynamically Gridview with the above properties.
Here I am showing my code t_name table name it is varable,I want to set
various table contains various field,Then I want generate Dynamically Gridview with the above properties.
Code:
string str = System.Configuration.ConfigurationManager.ConnectionStrings["sql"].ConnectionString;
SqlConnection con = new SqlConnection(str);
SqlCommand cmd;
SqlDataAdapter ad = new SqlDataAdapter();
con.Open();
cmd = new SqlCommand(“select * from t_name”, con)
ad.SelectCommand = cmd;
DataSet ds = new DataSet();
ad.Fill(ds, t_name);
GridView1.DataSource = ds;
GridView1.DataBind();
Comment