将数据库中带出的列,在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
}

 

posted @ 2017-01-13 11:51  水墨晨诗  阅读(120)  评论(0编辑  收藏  举报