【发布时间】:2011-04-20 18:13:49
【问题描述】:
我需要遍历一个网格视图,然后将其与我的数据库进行比较。
这就是我现在拥有的:
Dim rows As Integer = gwResults.Rows.Count()
For Each row As GridViewRow In gwResults.Rows
'move through rows and check data in each row against the dataset
cSource.GetDetails(Convert.ToInt32(row.Cells(1).Text))
Next
是否可以通过名称而不是索引来获取每列中的 gridview 值?所以可能有类似 cells("userID") 而不是 cells(5) 我有很多列,索引可能会变得非常混乱。
【问题讨论】:
-
例如,您可以使用类型化数据集。然后每一列都有自己的属性和适当的数据类型。