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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:08:54+00:00 2026-05-28T05:08:54+00:00

I am creating a couple different custom controls, each of which implement different base

  • 0

I am creating a couple different custom controls, each of which implement different base controls, but they all will be getting some common properties and functionality added to them. So I was wanting to place those common properties (with their common getters and setters) and the duplication of the functionality into an abstract class. But I’m having a hard time wrapping my head around how to architect the controls and its bases to allow the implementation of both my abstract class and the base web control I’m building on top of. Can anyone help me out?

Some of the controls I’m building

public class AssetDataStringControl : TextBox
public class AssetDataIntegerControl : TextBox
public class AssetDataUrlControl : CompositeControl
public class AssetDataListBoxControl : ListBox
public class AssetDataDropDownControl : DropDownList

My abstract class

public abstract class AssetDataInputControlBase<T> : Control, 
    IAssetDataInputControl<T>
{
    protected virtual int AssetId
    {
        get
        {
            object o = ViewState["AssetId"];
            return o == null ? 0 : (int)o;
        }
        set { ViewState["AssetId"] = value; }
    }

    protected virtual AssetStructureField StructureField
    {
        get
        {
            object o = ViewState["StructureField"];
            return o == null ? null : (AssetStructureField)o;
        }
        set { ViewState["StructureField"] = value; }
    }

    public abstract T DataField { get; set; }
}
  • 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-28T05:08:55+00:00Added an answer on May 28, 2026 at 5:08 am

    Forget about abstract. Seems to me that the .NET web control inheritance chain layers on functionality rather than forcing tons of implementation on the poor “end product” controls. I’d see if I can go with the flow on this. And this implies inheriting from the appropriate class to get the base upon which to build (pun intended).

    Looks like you want to build composite web controls. Read carefully the documentation on System.Web.UI namespace. Consider inheriting from System.Web.UI.CompositeControl. It gives you a child control collection and some built-in rendering. And it implements INamingContainer for managing child control unique IDs.

    Just a thought, maybe you can make a class that constructs custom composites at runtime (can you say factory pattern?). Read carefully the documentation on System.Web.UI namespace Anyway, the base already knows how to render the composite. Each sub-control (textbox, listbox, etc) knows how to render itself. In the factory, each sub-control is given it’s data binding. Then injects them into your custom CompositeControl constructor(s).

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

Sidebar

Related Questions

I'm creating XML file which will hold couple of values regarding TCP Connection (IP
I am creating an ASP.NET page where I need a couple of variables which
I have a couple of queries out here before I start creating my custom
I am developing a .NET Windows service that is creating a couple of threads
I have a couple questions about creating a object (2 values) and how to
I am trying to creating an optional association between a couple of tables. I
I have the following couple of C pre-processor macros for creating test functions: //
I have seen a couple of question regarding creating datasets in DbUnit here on
I asked a question a couple days ago about creating INSERTs by running a
I am creating a few JAX-WS endpoints, for which I want to save 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.