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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:12:32+00:00 2026-05-12T11:12:32+00:00

i am working on a project, with a set of usercontrols beeing loaded dynamically

  • 0

i am working on a project, with a set of usercontrols beeing loaded dynamically think about sort of a portal page with a bunch of widgets (blocks) and all of them are a usercontrol.
they have certain things in common, so i made them all derive from a masterBlock usercontrol

now is there a way to also have some output (in the .ascx) file in common?
anything i put in the ascx of the masterBlock is not rendered or overwritten by the derived block.

i was wondering if anyone has any hints to get this to work.

  • 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-12T11:12:33+00:00Added an answer on May 12, 2026 at 11:12 am

    The *.ascx files can not be derived (maybe with some “magic” can). Derived can be only classes, sou you can create a MyUserControlBase class, which can create some common controls/output and provide it by protected/public properties to derived class (MyWeatherUserControl for example) which can common controls/output modify.

    Sample code:

    public class MyUserControlBase : UserControl {
        private Panel mainPanel;
        protected Panel MainPanel {
            get { return this.mainPanel; }
        }
    
        public MyUserControlBase() {
            this.mainPanel = new Panel();
            this.Controls.Add( this.mainPanel );
            this.CreateMainPanelContent();
        }
    
        protected virtual void CreateMainPanelContent() {
            // create default content
            Label lblInfo = new Label();
            lblInfo.Text = "This is common user control.";
            this.MainPanel.Controls.Add( lblInfo );
        }
    }
    
    public class MyWeatherUserControl : MyUserControlBase {
        protected override void CreateMainPanelContent() {
            // the base method is not called,
            // because I want create custom content
    
            Image imgInfo = new Image();
            imgInfo.ImageUrl = "http://some_weather_providing_server.com/current_weather_in_new_york.gif";
            this.MainPanel.Controls.Add ( imgInfo );
        }
    }
    
    public class MyExtendedWeatherUserControl : MyWeatherUserControl {
        protected override void CreateMainPanelContent() {
            // the base method is called,
            // because I want only extend content
            base.CoreateMainPanelContent();
    
            HyperLink lnkSomewhere = new Hyperlink();
            lnkSomewhere.NavigationUrl = "http://somewhere.com";
            this.MainPanel.Controls.Add ( lnkSomewhere );
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Working on a project where a sequential set of methods must be run every
In a project I am working on, Apache is set up to only forward
I am working on a legacy Java Enterprise server project, trying to set up
In a project I'm working on, I have an object that is a sort
I'm about to upload a project I've been working on onto Sourceforge under the
Eclipse Helios: 40+ project working set, using maven (mvn-eclipse plugin) to generate eclipse project
I am working an an Android project to set up a PPTP and L2TP
Working with my ongoing TFrames-based component set project, I'm coming across various instances where
I am currently working on a project. In this project I have set of
I am working on a project where I have a set of known measurements

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.