开发者

Traversing Through GridView Data

I need to loop through a gridview to then compare it to my database.

this is what i have now:

   Dim rows As Integer = gw开发者_如何学编程Results.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

is it possible to get gridview values in each column by calling them by a name, instead of index? so maybe have something like cells("userID") instead of cells(5) i have many columns, and indexes could get really confusing.


If you enable paging in your GridView your approach wouldn't work at all, because then iterating Rows would only traverse the rows of the current PageIndex(by default 10 Rows).

You should use the DataSource of your GridView as source for your iteration. If you would provide more informations on what you're trying to do, we could assist you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜