Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 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 Professional 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 February 14th, 2007, 11:57 AM
jamara
Guest
 
Posts: n/a
Default Previous Page equal's Nothing

Hi, Thanks for reading and possibly providing help with this. I've been trying to pass a textbox value to another page but have been unsuccessful. The error message is that I have a null value exception.
There is a postURL on the button in the initial page. This button is made visible in the code if a SQL insert is successful.

<asp:Button ID="btnScanSubassembly" runat="server" Text="Scan Subassembly" CausesValidation="false" PostBackUrl="~/gd_scan_unit/scan_subassembly.aspx" Visible="false"/>

The textbox on the initial page is described below.
<asp:textbox ID="HiddenUnitKey" runat="server" Visible="false" />

Code that retrieves data from the original page:

        txtbxNHAUnitNo.Text = _
        CType(PreviousPage.FindControl("HiddenUnitKey"), TextBox).Text


        If Not txtbxNHAUnitNo Is Nothing Then
            strNHA = txtbxNHAUnitNo.Text
        End If

The books I have make it seem so simple yet I can't get it to work. Any assistance would be greatly appreciated.

Thanks,
Jamara

  #2 (permalink)  
Old February 14th, 2007, 12:07 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi there...

you have to use a hiddentextbox control, not a textbox with visible false...

the textbox you are using is not rendering to the page (b/c the visible=false)

that's why you can't find it...



HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
  #3 (permalink)  
Old February 14th, 2007, 12:32 PM
jamara
Guest
 
Posts: n/a
Default

Thanks Gonzalo but unfortunatly, that didn't solve the issue.

My code now looks like this:

Post-URL on initial page:

<asp:Button ID="btnScanSubassembly" runat="server" Text="Scan Subassembly" CausesValidation="false" PostBackUrl="~/gd_scan_unit/scan_subassembly.aspx" Visible="false"/>

The hidden field on the initial page:

<asp:Hiddenfield ID="HiddenUnitKey" runat="server" Value=<%strUnitKey%> />

PreviousPage directive on receiving page:

<%@ PreviousPageType VirtualPath="~/gd_scan_unit/scan_unit.aspx" %>

Code that retrieves data from the original page:

        txtbxNHAUnitNo.Text = _
        CType(PreviousPage.FindControl("HiddenUnitKey"), TextBox).Text


        If Not txtbxNHAUnitNo Is Nothing Then
            strNHA = txtbxNHAUnitNo.Text
        End If



  #4 (permalink)  
Old February 14th, 2007, 01:53 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

mmm.. then you got me :(

try to get other fields to see if that work.

take in mind that you are casting the hiddenfield type to a textbox....



HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
  #5 (permalink)  
Old February 14th, 2007, 02:12 PM
jamara
Guest
 
Posts: n/a
Default

Does anyone have any suggestions for doing this another way? I have tried several books including Professional ASP.NET 2.0 Special Edition by Bill Evjen and Murach's ASP.NET 2.0 Upgrader's Guide. Nothing seems to work. I've been trying this for 2 days and have come to the conclusion that it just doesn't work. I just want to access a data element (don't care about type any longer)in page2 from page1.
I've also tried consuming exposed properties from Bill Evjen's book samples.


  #6 (permalink)  
Old February 14th, 2007, 02:17 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

session variables???

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
  #7 (permalink)  
Old February 14th, 2007, 02:24 PM
jamara
Guest
 
Posts: n/a
Default

I'll try it! Please look for post later in case I need additional assistance. Thanks for replying!

  #8 (permalink)  
Old February 14th, 2007, 02:58 PM
jamara
Guest
 
Posts: n/a
Default

Well, I've tried session variables by using the example in Professional ASP.NET 2.0 Special Edition by Bill Evjen but that was 'Nothing' too. At this point, I think there must be something in the pages which is not allowing me to post variables to another page. Are there settings which must be set in order to do this? Is there something perhaps in the web.config file or in the page declarative? Does anyone have a working example of any type variable passed to another page by using any method?

  #9 (permalink)  
Old February 14th, 2007, 03:09 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

mm.. can you post some of the relevant code of the call to the next page (where you save the session variable) and the call of the receiving page (the one where you read the variable)...

this should be working straightforward...

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
  #10 (permalink)  
Old February 14th, 2007, 03:46 PM
jamara
Guest
 
Posts: n/a
Default

Gonzalo,
In my frustration, I had a typo in the variable name and didn't notice it. Session variables does work and is simple and straightforward.
Thanks for the suggestion!
Jackie



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find previous page gandaliter PHP How-To 2 June 7th, 2007 11:55 AM
Page 1-2-3-4 etc.... Next and Previous buttons crmpicco Classic ASP Basics 1 March 18th, 2005 12:00 PM
Checking Previous Page shs BOOK: Beginning ASP.NET 1.0 2 September 23rd, 2004 11:01 PM
next and previous page results mikeuk PHP Databases 1 July 19th, 2004 05:15 AM
go back previous page hosefo81 PHP How-To 2 February 11th, 2004 01:50 PM





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