复制代码 代码如下:
void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow ||
e.Row.RowType == DataControlRowType.Header)
{
//隐藏第1列
e.Row.Cells[0].Visible = false;
//可以根据需要隐藏更多的列
}
}
复制代码 代码如下:
protected void gvUnit_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//获取隐藏列的值
if (e.Row.Cells[1].Text == "xxx")
{
//TODO
}
}
}
新闻热点
疑难解答
图片精选