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

Let's say I have a class Voucher: public class Voucher { public Guid Id
an svn:externals reference like this dojo -r 21434 http://svn.dojotoolkit.org/src/dojo/trunk/ is happily accepted by subversive
I am doing pass-by-reference like this: use strict; use warnings; sub repl { local
I'm working on visualizing a matrix in R (almost exactly like http://reference.wolfram.com/mathematica/ref/MatrixPlot.html ), and
I would like to cross-reference construct a distance chart similar to the one here
i would like know some reference. I know i can googling it. but prefer
I would like to have a reference for the pros and cons of using
I'd like to map a reference to an object instead of the object value
I would like to pass a reference of a method into another method and
I'd like to get a reference to the object whose view was touched on

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.