?
Solved

ASP PreviousPage.FindControl

Posted on 2007-07-26
4
Medium Priority
?
566 Views
Last Modified: 2008-01-09
I have a Text Box that I Type Information in and then I Click a button and i want to get the information from the Text box on the current page i am trying to use PreviousPage.Findcontrol and it keeps saying the NullException
0
Comment
Question by:DRSLT
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
steveberzins earned 1200 total points
ID: 19579884
as far as I know, previous page is only applicable in cross page postback situations, or it says will also work with Server.Transfer, but haven't seen examples using the latter.

http://msdn2.microsoft.com/en-us/library/system.web.ui.page.previouspage.aspx

are you using server.transfer, or using the button PostBackUrl property to send it to the next page?
0
 
LVL 14

Expert Comment

by:steveberzins
ID: 19579906
also, a good idea, if there is any other way to get to that page, to explicitly check that PreviousPage is not null before doing anything with it, just good practice to make sure an object, actually is something, before doing something with it.
0
 
LVL 5

Assisted Solution

by:ddelhez
ddelhez earned 800 total points
ID: 19580839
Is your textbox part of a <form> ?
If yes, the button you click could be the "submit" button of that form
and then you could simply use the Request.Form object to find the content of that textbox ...

wouldn't it be simpler ?
0
 
LVL 1

Author Comment

by:DRSLT
ID: 19581817
I ended up using Server.Transfer(~/PageName.aspx) and on the Next Page i used ((TextBox)this.PreviousPage("id")).Text and it gets the value and i am going to check to make sure the previous page is defined if not i will bounce them back to the original page.

THANKS
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Screencast - Getting to Know the Pipeline
Suggested Courses

864 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