get id column value from gridview?
-
Hi, i've got a datasource ie "employees" with columns id, name, surname. I'm binding to a gridview, but display only name, surname but i'v added a select column. How do I get the ID VALUE for the selected row, when i click on select hyperlink in the select column. thx
Regards, Tintin
-
Hi, i've got a datasource ie "employees" with columns id, name, surname. I'm binding to a gridview, but display only name, surname but i'v added a select column. How do I get the ID VALUE for the selected row, when i click on select hyperlink in the select column. thx
Regards, Tintin
Get it from the DataKeys collection for the selected row like this? Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridView1.RowDeleting Try Dim iInt As Integer = CType(GridView1.DataKeys(e.RowIndex).Value, Integer) ' Do stuff here Catch ex As Exception LogException(ex) End Try End Sub