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 7945001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:43:21+00:00 2026-06-04T00:43:21+00:00

I have the following situation: Page1.aspx is based on a master page and has

  • 0

I have the following situation:

Page1.aspx is based on a master page and has a hidden field called “hdFlotaID” in it. On the same page I have a button for which I set PostBackUrl="Page2.aspx". When I click the buton, the Page2 is loaded but I can’t get the hidden field. I tried both (as I saw on msdn or other posts):

this.PreviousPage.Controls[0].FindControl("hdFlotaID")

and

this.PreviousPage.FindControl("hdFlotaID")

but they return null.

This.PreviousPage returns a value, but Controls[0] of that value seems to return the masterpage and I want the content page.

I also checked and the hidden field has runat server value and ClientID mode is set to static (I even checked the generated HTML and the ID is correct)

Can you please help me! Thank you

SOLUTION: Ok,so based on your help I got it to work like this

this.PreviousPage.Controls[0].FindControl("CPH").FindControl("hdFlotaID")

where CPH is the ID of the ContentPlaceHolder from the master page.

Also the ideea with the public property is very good allthough in my case adding the PreviousPageType directive was giving me some errors about namespaces. If I removed the directive and cast it in codebehind it works fine.

Thank you all very much

  • 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-06-04T00:43:23+00:00Added an answer on June 4, 2026 at 12:43 am

    FindControl searches only one level i.e. top level container and all the controls of your content page are not directly in Master control collection rather inside master’s content control collection.

    To achieve this

    1) you need to write a recursive version of FindControl. try like this (did not tested it):

    ((Page1)this.PreviousPage).FindControl("hdFlotaID")
    

    or

    2) Typecast the previous page to the type of page it is. Then you can access controls.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following situation: An Conversations entity/table which has multiple Tags associated to
I have the following situation on my new ASP.Net page: I am using a
I have the following situation quite simple (1 page, 3 zones : left -
Let's imagine the following situation: You have a simple php page with an html
I have the following control on my ASPX page: <asp:TextBox ID=txtISBN13 runat=server ClientIDMode=Static />
I have a the following situation: pages has many groups. Now i am trying
I have following situation - Have a MongoService class, which reads host, port, database
I have following situation. In a constructor of a pseudo class I attach a
I have following situation (simplified, of course): MyDomain.groovy: class MyDomain { MyAnotherDomain anotherDomain //
I have following situation, String a=<em>crawler</em> <em> Yeahhhhh </em></a></h3><table; System.out.println(a.indexOf(</em>)); It returns the 11

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.