【发布时间】:2012-11-08 09:20:34
【问题描述】:
我有一个 gridview,我想禁用它的最后 5 行我该怎么做?下面的代码不起作用
protected void gview_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Enabled = e.Row.RowIndex <= 5; //for disabling last 4 rows
}
}
【问题讨论】:
-
您也可以通过将行设置为“只读”来做到这一点