Change header text of columns in a GridView

前端 未结 6 598
天涯浪人
天涯浪人 2020-12-08 14:26

I have a GridView which i programmatically bind using c# code. The problem is, the columns get their header texts directly from Database, which can look odd when presented o

6条回答
  •  [愿得一人]
    2020-12-08 15:03

    You can do it with gridview's datarow bound event. try the following sample of code:

    protected void grv_RowDataBound(object sender, GridViewRowEventArgs e)
    {
    if (e.Row.RowType == DataControlRowType.Header)
    {
    e.Row.Cells[0].Text = "TiTle";
    }
    }
    

    For more details about the row databound event study Thsi....

提交回复
热议问题