find 2 datakeys in cowcommand

I have this code that finds the a datakey in a gridview

The problem is that I have 2 datakeys in the gridview and I can't get the 2nd one..

The below code just accesses the first datakey but how do I access the 2nd?


 
Protected Sub GridView2_RowCommand(sender As Object, e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView2.RowCommand
        Dim currentCommand As String = e.CommandName
        Dim currentRowIndex As Integer = Int32.Parse(e.CommandArgument.ToString())
        Dim EmailAdd As String = GridView2.DataKeys(currentRowIndex).Value

Open in new window

EdAsked:
Who is Participating?
 
Rajar AhmedConsultantCommented:
Try this :
http://www.aspdotnet-suresh.com/2012/06/get-multiple-datakeyname-values-from.html
Dim gvrow As GridViewRow
Dim value1 As String = gvUserInfo.DataKeys(gvrow.RowIndex).Values(0).ToString()
Dim value2 As String = gvUserInfo.DataKeys(gvrow.RowIndex).Values(1).ToString()
Dim value3 As String = gvUserInfo.DataKeys(gvrow.RowIndex).Values(2).ToString()

Open in new window

Convert C#to vb
http://converter.telerik.com/

Meeran03
0
 
EdAuthor Commented:
Worked Perfectly, thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.