How to get column name from gridview?

后端 未结 6 1901
南旧
南旧 2020-12-20 15:32

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.

6条回答
  •  醉梦人生
    2020-12-20 16:05

    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.

提交回复
热议问题