Question : Getting Column Names from RowDataBound

I have a RowDataBound event and would like to get the Columns for the Gridview?

My Gridview uses an SQL Datasource and the column headers are generated.

Answer : Getting Column Names from RowDataBound

If you don;t have sorting enabled there won't be a link button....
You can get header text like:

string header = GridView1.Columns[i].HeaderText; //  i is the 0-based index for the column

Or you can also get it like:

string header = GridView1.HeaderRow.Cells[i].Text;
Random Solutions  
 
programming4us programming4us