Posted on 2008-11-12
Last Modified: 2012-05-05
On Datakeyname in Gridview properties, I have "cid, firstname"), but why this won't work?

    Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged

        Dim idNum As String = Me.GridView1.SelectedDataKey.Value("cid").ToString
        Dim idNum2 As String = Me.GridView1.SelectedDataKey.Value("firstname").ToString

        Dim URL As String = [String].Concat("test.aspx?cid=", idNum & idNum2)


    End Sub
Question by:VBdotnet2005
    1 Comment
    LVL 6

    Accepted Solution

    I don't believe that GridView1.SelectedDataKey.Value accepts a string. Maybe try something like GridView1.SelectedDataKey.Item("[name]").ToString()

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now