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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:43:12+00:00 2026-05-21T10:43:12+00:00

Id like to reference a property in my .aspx from my .ascx. Lets say

  • 0

Id like to reference a property in my .aspx from my .ascx.

Lets say my page class is:

public partial class MyAdminPage : System.Web.UI.Page

I was expecting I could do from my .ascx:

MyAdminPage myPageInstance = (MyAdminPage)this.Page;

or

MyAdminPage myPageInstance = this.Page as MyAdminPage;

Which I cant.

How could I reference my page class from the .ascx?

Update 1

Thanks for the replies.

I forgot to mention that the .aspx has a master page, and within the contentPlaceholder is where I have the .ascx control.

So from my .ascx if I do:
this.Parent –> I get a reference to “ContentPlaceHolder”
this.Parent.Parent –> I get a reference to “HtmlForm”
this.Parent.Parent –> reference to a ‘MasterPage’.

I will not reuse the .ascx in any other .aspx pages just the one.

  • 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-21T10:43:13+00:00Added an answer on May 21, 2026 at 10:43 am

    sJohnny’s comment is spot on, you should not be trying to modify parent (page) properties from the child (control). One good way to handle this situation is for the child to raise an event when it needs the parent to act. That way the parent can simply subscribe to the event and call whatever properties it needs at that time. This way your user control is in no way tied to the implementation of this particular page.

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

Sidebar

Related Questions

I have a vb.net 3.5 class library project that needs to reference two assemblies
i try to save an margin value in a resourcedictionary. Something like that: xmlns:systemwindows=clr-namespace:System.Windows;assembly=System.Windows.dll
I'm trying to execute some javascript code on my UpdatePanel's OnLoad event like so:
So, I'm attempting to use this: http://blogs.msdn.com/b/priozersk/archive/2010/09/17/customizing-picker-box-dialog.aspx However, I just want a normal pickerboxdialog
I have built a web form with some tables and custom controls inside it,
This is driving me crazy. In the past I have been able to have
Enviroment: Asp.Net 3.5, VS 2008, Windows XP Hello, i have a user control (uc:StackUC)
I have a simple navigation hierarchy: Controller 1 > Controller 2 > Controller 3
The following LINQ to Entities query (using EF 4.1 Code-First), is supposed to create
Even with all I do know about the AppEngine datastore, I don't know the

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.