Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
| Search | Today's Posts | Mark Forums Read
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
  #1 (permalink)  
Old October 18th, 2006, 08:32 PM
Registered User
 
Join Date: Oct 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Posting Values between several pages

 keep running into Object reference not set to an instance of an
object problem and I'm not sure why. My source page has a couple of
textboxes and dropdowns that post values to page2.aspx. I used public
members on the source page because the information is not sensitive.
When i click on the button which has a postbackurl it works fine. Now,when I want to post a value from page2.aspx to page3.aspx I get the object reference problem. I have been trying to figure it out but with no luck, the only useful information I found was on msdn which stated if the current page is not the target of a cross-page post, the PreviousPage property returns null . Can anyone help point me in the right direction? or is there a better way of posting values across several pages?
  #2 (permalink)  
Old October 21st, 2006, 01:06 AM
Authorized User
Points: 333, Level: 6
Points: 333, Level: 6 Points: 333, Level: 6 Points: 333, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2005
Location: Fresno, California, USA.
Posts: 94
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This could take awhile to explain. Almost seems easier to put the info in sessions hehe.
Don't know what you are trying to accomplish but if you are tryingto post data from source to page 2 and then from page 2 to page 3 then the submit button on source should have a postback url pointing to page 2. Page 2 submit button should have a postback url pointing to page 3. When you submit on source, the code will be processed on page 2 and page 2's will be processed on page 3. To access data, you have to read the object from previous page and it will be an object not typed. You will have to cast it. Like if you have a textbox on source called:
txtMyTextbox

Then you would read it from page 2 first like so on page 2 code behind:
Textbox txtMyTextboxSource = (Textbox)Page.PreviousPage.FindControl("txtMyTextb ox");

Now from txtMyTextboxSource I can access the stuff that was in the previous page. Hope that helps some.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Pass values between pages msbsam ASP.NET 2.0 Professional 1 July 7th, 2008 06:13 AM
How to pass values between different pages dipanjan22 ASP.NET 1.x and 2.0 Application Design 4 September 30th, 2007 02:02 PM
cross-page posting within pages with master file.. poogles ASP.NET 2.0 Basics 2 August 6th, 2007 05:11 AM
First Posting - Savings in first 20 pages. Bob Hansen BOOK: Expert One-on-One Access Application Development 2 May 20th, 2004 08:06 PM
Hashing of URL while posting web pages debsoft General .NET 1 April 22nd, 2004 09:20 AM





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