Configuring a SQLDataSource - passing a parameter from a gridview to a DetailsView on a separate page

Posted on 2009-02-18
Last Modified: 2013-11-07

I have a gridview on one page which summarises information but would like to be able to select a line to open up a DetailsView. Now I know how to do this if your gridview and detailsview are on the same page as you can reference the parameters easily with the nominated datakeyname.

What I would like to do is open up a separate page to display the detailsview. My question is how do I link parameters from one page to another? I have tried configuring the SQLdatasource but there are obviously no references to a grid view on a different page.

Many thanks in advance

Question by:crossra
    LVL 18

    Accepted Solution


    Pass the parameter using a QueryString:

    Dim strUrl As String = "~/DetailsPage.aspx?ID=" & GridView1.SelectedValue.ToString

    Or using a Session parameter, i.e:

    Session("ID") = GridView1.SelectedValue.ToString

    And on the new page add a datasource and use either a QueryString parameter or a Session parameter.


    Author Comment

    That's brilliant. I used the Session parameter and it worked a treat.

    Thanks Carl.

    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    Suggested Solutions

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    754 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

    17 Experts available now in Live!

    Get 1:1 Help Now