首页 > 代码库 > 将某列内容和标题隐藏起来
将某列内容和标题隐藏起来
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;
}
}
}
将某列内容和标题隐藏起来