在RowCreated事件中书写如下代码
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
}
//可以根据需要设置更多的列
}
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控件的RowCreated事件中进行操作,具体包括隐藏第1列,以及如何根据需要设置更多的列可见性。
98

被折叠的 条评论
为什么被折叠?



