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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:01:17+00:00 2026-05-12T15:01:17+00:00

Right now I have a base class for my pages which inherits System.Web.UI.Page and

  • 0

Right now I have a base class for my pages which inherits System.Web.UI.Page and another base class for my usercontrols which inherits System.Web.UI.UserControl, these classes contains the same methods. Since C# doesn’t support multiple inheritance I can’t combine the two classes into one that inherits both Page and UserControl.

What would be the best way to keep the functionality in the two base classes but have the implementation of these methods in only one place?

I’m thinking of making a interface and let the two base classes call a third class that contains the implementation of the interface. Is there any better way so that when I add a new method I don’t have to do it in three places (even though the implementation is only in the third class).

  • 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-12T15:01:17+00:00Added an answer on May 12, 2026 at 3:01 pm

    If you are using C# 3.0, you can provide your helper methods as extension methods for the System.Web.UI.Control class, of which both System.Web.UI.Page and System.Web.UI.UserControl classes derive.

    public static class ControlExtensions {
        public static void DoSomething(this Control obj) {
           // do something
        }
    }
    

    In the Page or UserControl:

    this.DoSomething();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a BasePage class that inherits from System.Web.Ui.Page. In that base class
I am a bit stuck right now. I have a base class called BaseBond.
Right now I have a function, in a class that is used to listen
Right now I have this SQL query which is valid but always times out:
I have a data object which has a base class with three derived classes,
I have an interface for a base class, and every class that inherits from
Right now, what I have is, when the user clicks on the page, the
I have a container which holds a bunch of pointers to a base class,
I have a base abstract class with several classes which extend and override it,
Right now my class is set up as: enum Unit{Inches,Centimeters}; Later on I have

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.