Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 9th, 2006, 12:03 PM
Authorized User
 
Join Date: Feb 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Master-Detail example with Session variable

Hello - I'm looking for some examples of implementing a Master-Detail page as separate pages, and passing the linking field value through a Session variable, instead of the QueryString (in this case, I'm using the social security number, and can't have that sticking out there in the address bar)

Thanks

Mark

 
Old March 9th, 2006, 02:49 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

What are you using a gridview? When you click the row, grab the value you need. Set a session variable. Redirect to your page, grab the session variable and use it as a parameter in your sql statment. Execute it and display the results.

Jim

 
Old March 10th, 2006, 08:36 AM
Authorized User
 
Join Date: Feb 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've tried that. The master page has a GridView, with DataKeyNames = SSN, and in the GridView1_SelectedIndexChanged sub, I've got:

   Session("SSN") = GridView1.SelectedDataKey
   Response.Redirect("..\Res_Client\DetailPage.aspx")

And then on the Detail page, I've got an AccessDataSource with a WHERE clause of Source = Session and Session field = SSN

But when run the Master page and click on a "Select" for a row, I get an error message about "Object must implement IConvertible"

Somebody told me to use Ctype(), but didn't elaborate on where/how to put it. I tried it in the Master page code:

   Session("SSN") = CType(GridView1.SelectedDataKey, DataKey)

, but it was no help. (The data is in an Access mdb, and SSN is a text field)

Thanks for your help

Mark

 
Old March 11th, 2006, 10:57 PM
Authorized User
 
Join Date: Feb 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, I got an answer - I didn't realize SelectedDataKey was an object variable; here's what works:

      Session("SSN") = GridView1.SelectedDataKey.Value






Similar Threads
Thread Thread Starter Forum Replies Last Post
master-detail hhpatek ADO.NET 0 April 3rd, 2008 02:53 PM
Master Detail prasanta2expert Access VBA 1 October 1st, 2007 06:37 AM
Master-Detail with Datalist comicghozt ASP.NET 1.0 and 1.1 Basics 0 June 7th, 2006 03:41 AM
Master/Detail page yteferi ASP.NET 2.0 Basics 1 April 5th, 2006 04:06 PM
master/detail beeyule Dreamweaver (all versions) 1 January 18th, 2005 02:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.