.NET中GridView代码更改列名
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1.直接在GridView中修改
GridView1.DataSource = ds.Tables[0].DefaultView; GridView1.DataBind();
GridView1.HeaderRow.Cells[0].Text = "ID"; GridView1.HeaderRow.Cells[1].Text = "班级";
2修改数据源 dataView.Table.Columns[0].ColumnName = "列1";
1.直接在GridView中修改
GridView1.DataSource = ds.Tables[0].DefaultView; GridView1.DataBind();
GridView1.HeaderRow.Cells[0].Text = "ID"; GridView1.HeaderRow.Cells[1].Text = "班级";
2修改数据源 dataView.Table.Columns[0].ColumnName = "列1";