protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
((TextBox)e.Row.Cells[0].FindControl("TextBox3")).Attributes.Add("onkeyup", "javascript:sumsy(this);");
e.Row.Cells[13].Style.Add("display", "none"); //隐藏数据列
e.Row.Cells[14].Style.Add("display", "none");
}
else
{
e.Row.Cells[13].Style.Add("display", "none"); //隐藏表头
e.Row.Cells[14].Style.Add("display", "none");
}
}
ASP.net 用CSS 来隐藏 GridView 的列
最新推荐文章于 2021-06-04 18:34:05 发布
本文介绍如何使用ASP.NET中的GridView控件自定义行数据绑定事件,通过RowDataBound事件实现对特定行的数据操作,例如为文本框添加键盘事件处理程序及隐藏指定列。
4139

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



