[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2009-02-18
2
Medium Priority
?
489 Views
Last Modified: 2013-11-07
Hello

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

Rich
0
Comment
Question by:crossra
2 Comments
 
LVL 18

Accepted Solution

by:
carlnorrbom earned 500 total points
ID: 23669139
Hi,

Pass the parameter using a QueryString:

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

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.

/Carl.
0
 

Author Comment

by:crossra
ID: 23669341
That's brilliant. I used the Session parameter and it worked a treat.

Thanks Carl.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Integration Management Part 2
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month18 days, 17 hours left to enroll

834 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