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

  • Home
  • SEARCH
  • 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 109363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:03:27+00:00 2026-05-11T02:03:27+00:00

I have a ChildUserControl that is loaded inside a ParentUserControl. The host page loads

  • 0

I have a ChildUserControl that is loaded inside a ParentUserControl. The host page loads ParentUserControl.

I would need to access properties in ParentUserControl from the ChildUserControl.

Thanks for your time

  • 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. 2026-05-11T02:03:28+00:00Added an answer on May 11, 2026 at 2:03 am

    The platform / language etc isn’t clear, so this answer is necessarily vague… however, in general a child control can’t access properties from the parent (directly), because lots of different types of parent controls could be hosting the child control. The child shouldn’t be hard-coded to a single parent, otherwise it might as well be part of the parent.

    Generally, you might want to try to simply remove the requirement – it sounds like an odd design. However, some frameworks support something like this – for example, dependency properties in WPF.

    An interface-based design (for the parent(s)) is one approach, but this isn’t very clean. For .NET, events etc are another common way for a child to communicate with a parent – the child exposes events which different parents can consume in different ways.

    Other than that, you’re into the territory of testing/casting the parent (either against a class or an interface) to access details from the parent – for example:

    ParentControlType parent = this.Parent as ParentControlType; if(parent != null) {     // access properties etc of 'parent' } 

    (could also use an interface here; still a bit hacky either way…)

    Personally, rather than use this type of cast from the child, I’d prefer the parent to take control; the parent sets properties on the child, and listens to events (rather than the child set properties back on the parent):

    // in the parent child.SomeProperty = 132; child.SomePropertyChangd += delegate {     // do something at the parent }; 

    This way, the child doesn’t know or care about the parent. All it knows is that it has properties (etc), and can notify other people to interesting changes.

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

Sidebar

Related Questions

Have a bunch of WCF REST services hosted on Azure that access a SQL
Have a network location that shows paths in the 8.3 short format. I need
Have a bunch of classes which I need to do serialize and deserialize from/to
have 2 questions : A computer with 32-bit address uses 2-level page table (9
Have 2 tables in Access 2007, both lists of certain tasks to be accomplished.
have a nice day. I got problem when trying to create an image from
I am using a masterpage. On a accounts page I have a Usercontrol on
Have converted devise new session from erb to Haml but doens't work, this is
Have searched the database but need to specifically sum(of hours flown or days off)in
Have a look at one of my websites: moskah.com The problem is that it

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.