我有一个页面大小为 6 的网格视图。现在在按钮单击事件中,我需要访问网格视图的所有可用行,因为所有控件都是可编辑的,因此我需要扫描所有元素。然而声明
For Each row As GridViewRow In UserNoteGrid.Rows
仅针对当前页面运行,而不是针对每个页面中的所有可用行。我怎样才能访问它。谢谢
你可以使用这样的东西:
Protected Sub UserNoteGrid_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles UserNoteGrid.RowDataBound
e.Row.Cells(1).Text = "test ..."
End Sub
请检查 ...
'after binding
GridView1.AllowPaging = False
For Each row As GridViewRow In GridView1.Rows
'some work
Next
GridView1.AllowPaging = True