Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7038627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:41:31+00:00 2026-05-28T01:41:31+00:00

I’m really struggling with this. The problem is only with the content pages. I

  • 0

I’m really struggling with this. The problem is only with the content pages.
I am trying to access a Text Box value from one content page (“Page1.aspx”) in another content page (“Page2.aspx”). I’m not sure whether it is relevant that they are the children of nested master pages, but I thought I’d throw it in.

Page1.aspx is a basic form with text boxes and a submit button. The text box in Page1.aspx is called “tbFirst”. The submit button has the following code:

<asp:Button ID="Button1" runat="server" Text="New Member Form" PostBackUrl="Page2.aspx"/>    

Page2.aspx is a new form which should be populated with a textbox value from the previous page.
The second line show <%@ PreviousPageType VirtualPath=”~/Page1.aspx” %>
For testing purposes I am using a label (“lblResult”) to display my results.

Codebehind looks like this:

        if (PreviousPage != null)
        {
            TextBox SourceTextBox =
                (TextBox)PreviousPage.FindControl("tbFirst");
            if (SourceTextBox != null)
            {
                lblResult.Text = SourceTextBox.Text;
            }
            else
            {
                lblResult.Text = "No text found";
            }  
        }
        else
            {
            lblResult.Text = "No Control found";
            }
        }
        }

The problem is that the label text in Page2.aspx says “No text found”.

I think that’s all the relevant info. Anyone got any ideas? I’ve spent the whole afternoon trawling the forums and nothing I’ve tried works.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:41:32+00:00Added an answer on May 28, 2026 at 1:41 am

    I’m not sure whether it is relevant that they are the children of
    nested master pages, but I thought I’d throw it in.

    The MasterPage is exactly what’s causing this issue. You cannot find a control on a page with MasterPage by using Page.FindControl("ControlID"), because the Page is not the NamingContainer of the TextBox but the ContentPlaceholder. The only control in the page’s ControlCollection with MasterPage is the MasterPage itself.

    Reason: I’ve recently answered a question that describes this behaviour.

    Here are some ways how you can access the TextBox from Page2:

    1. You might have luck with following approach(the most direct FindControl way):

      Page.Master.FindControl("ContentPlaceHolder1").FindControl("tbFirst");
      
    2. Another, better approach would be to provide a public property in Page1 that returns tbFirst.Text. Then you could access it in the following way from Page2:

      if (PreviousPage != null && PreviousPage is Page1){
          lblResult.Text = ((Page1)PreviousPage).TbFirstText;
      }
      
    3. You could also add the Text as URL-Parameter, so that it’s not required that Page2's PreviousPage is Page1.

    4. Last but not least. If you use Server.Transer with preserveForm set to tue, you would be able to retrieve the value of the original page TextBox control by referencing Request.Form("TbFirst").

    Note: I don’t recommend a recursive FindControl approach(starting from MasterPage), because it would also hardwire both pages and would be

    • a cause of nasty errors
    • slow
    • untransparent
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a bunch of posts stored in text files formatted in yaml/textile (from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.