Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


find 2 datakeys in cowcommand

Posted on 2012-09-13
Medium Priority
Last Modified: 2012-10-14
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

Question by:Ed
LVL 18

Accepted Solution

Rajar Ahmed earned 2000 total points
ID: 38396000
Try this :
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


Author Closing Comment

ID: 38495215
Worked Perfectly, thanks

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question