|
-
Nov 21st, 2008, 11:28 PM
#1
Thread Starter
Hyperactive Member
Get index of the gridview row when clicks on linkbutton
Hello,
I have a gridview with a linkbutton as template field. I need to get the row index of the link button clicked inside the gridview. Currently i am using the below code to extract,
Protected Sub lnkCancel_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim lnk As LinkButton = DirectCast(sender, LinkButton)
lnk.ToolTip = "1"
Dim index As Integer = 0
Dim i As Integer = 0
For Each row As GridViewRow In gridListNames.Rows
Dim lnkBut As LinkButton = DirectCast(row.FindControl("lnkCancel"), LinkButton)
If lnkBut.ToolTip & "" Then
index = i
Exit For
End If
i += 1
Next
lnk.ToolTip = ""
Dim lnkCanc As LinkButton = DirectCast(gridListNames.Rows(index).Cells(2).FindControl("lnkCancel"), LinkButton)
End Sub
Is there any simple code to get the row index of the link button clicked ... ???
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|