How to Determnine which Button is clicked in a GridView in VB.NET
I found the solution:
I was facing a similar situation and this is what I did.
I added one SELECT button and one ButtonField which I called "btntrack".
When the select command was clicked I could trigger whatever event I wanted to. then I create the statement below to find out when the ButtonField was clicked and trigger a different event.
I also made the ButtonField appear and look like a select field by changing the ButtonType to Image and assigning a small image that would look good.
Then I created some code to make it act like a select command by changing the SelectedIndex every timea a different row was clicked.
"How to Determnine which Button is clicked in a GridView"
Protected Sub gvMain_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gvMain.RowCommand
If e.CommandName = "btnTrack" Then
gvMain.SelectedIndex = e.CommandArgument
End If
End Sub
www.data2bi.com
Specialists in Business Intelligence implementation and development.
Database Desing, Management, Custom application development, Database perfomance tunning, Network Administration and VoIP Implementation.