Gridview将某列内容和标题隐藏起来

protected void gvInfo_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
switch (id)
{
case "1":
e.Row.Cells[12].Visible = false;
e.Row.Cells[13].Visible = false;
gvInfo.HeaderRow.Cells[12].Visible = false;
gvInfo.HeaderRow.Cells[13].Visible = false;
break;

case "6":
e.Row.Cells[11].Visible = false;
e.Row.Cells[12].Visible = false;
gvInfo.HeaderRow.Cells[11].Visible = false;
gvInfo.HeaderRow.Cells[12].Visible = false;
break;

default:
e.Row.Cells[11].Visible = false;
e.Row.Cells[13].Visible = false;
gvInfo.HeaderRow.Cells[11].Visible = false;
gvInfo.HeaderRow.Cells[13].Visible = false;
break;
}
}
}

上一篇:解如下方程(java实现)


下一篇:vue路由切换时内容组件的滚动条回到顶部