Gridview 隐藏列

 protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Header)
        {
            e.Row.Cells[0].Visible = false; //如果想使第1列不可见,则将它的可见性设为false
        }
    }

你可能感兴趣的:(GridView)