将数据库中带出的列,在gridview中影藏起来

前台增加事件:OnRowCreated="GridView1_RowCreated"

protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Header)
{
e.Row.Cells[3].Visible = false; //如果想使第3列不可见,则将它的可见性设为false
}
原文地址:https://www.cnblogs.com/vichin/p/6282187.html