Inzi Irina Inzi Irina - 5 months ago 28
SQL Question

How to get column name from gridview?

I would like to know how can I get a column name from a gridview? by its number not by name.
like : Name|Age|Birthday: ( so name=0 , age=1 etc...)

thanks.

Answer

You can get it like this :

gv.HeaderRow.Cells[i].Text

Or like this :

gv.Rows[0].Cells[i].Text

Rows[0] should be your header row.