simple thing get a list of columns present in the binded grid view, thats it. but gives errors.
try to get the number of columns also does not work! it says zero?
heres the code,
please help
code> try { commandString = "Select * from Table_1"; conn = new SqlConnection(Class1.connection); command = new SqlCommand(commandString, conn); conn.Open(); reader = command.ExecuteReader(); GridView1.DataSource = reader; GridView1.DataBind(); //also not wrking?? Label1.Text = GridView1.Columns.Count.ToString; reader.Close(); reader.Dispose(); conn.Close(); conn.Dispose();
whats wrong,
is there an alternate way to ask grid view for its columns?
autogenerate columns is true.