ds.Tables[0].Columns["id"].ColumnMapping=MappingType.Hidden;
dataView1.AutoGenerateColumns=true;
gridView1.DataSource=ds;
gridView1.DataBind();
隐藏了 id 但id还是显示
列是自动生成的,我要隐藏id 怎么办
------解决方案--------------------------------------------------------
这个问题,我知道,呵呵,在GridViw 的RowDataBound() 事件中
protected void GVList_RowDataBound(object sender, GridViewRowEventArgs e)
{
//隐藏不必要的列
if ((e.Row.RowType == DataControlRowType.DataRow) || (e.Row.RowType == DataControlRowType.Header) || (e.Row.RowType == DataControlRowType.Footer))
{
e.Row.Cells[0].Visible = false;
e.Row.Cells[3].Visible = false;
}
}