Row keys for an ASP.NET 2.0 GridView

Written on December 22, 2005

I only just discovered this today, that if you tell a GridView control via its DataKeyNames property what the key column for each row is, then you can retrieve that value later by using the DataKeys property.


Dim sectionId As Integer = _ CInt(GridView1.DataKeys(row.RowIndex).Value)

Categories: .NET