ASP PreviousPage.FindControl

Posted on 2007-07-26
Medium Priority
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
Question by:DRSLT
  • 2
LVL 14

Accepted Solution

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.


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

Expert Comment

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.

Assisted Solution

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 ?

Author Comment

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.


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