I have standard .net 2.0 gridview control from which i want to get row keys or cell values from the grid when a row is selected.
I also need to call a method each time a row is selected.
Does anybody know How i can do this using ASP.net & VB?
I have standard .net 2.0 gridview control from which i want to get row keys or cell values from the grid when a row is selected.
I also need to call a method each time a row is selected.
Does anybody know How i can do this using ASP.net & VB?
Add a button or link button to your gridView.
For the command name put in "Select"
In the designer window, double click your gridView and your selected index changed method will be automatically generated.
I assume you mean selection by the Select command. That fires a SelectedIndexChanged event. and from there on you have the SelectedDataKey.Value (or .Values) for the Key.
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, _
ByVal e As EventArgs) _
Handles GridView1.SelectedIndexChanged
Dim key As Object = GridView1.SelectedDataKey.Value
End Sub
I prefer using third-party grid like the Telerik one which allows server and client selection as well as postback on click to process some logic.
Dick