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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:31:12+00:00 2026-05-24T01:31:12+00:00

I am using Telerik’s Rad Controls for AJAX. I have created my own controls;

  • 0

I am using Telerik’s Rad Controls for AJAX. I have created my own controls; their classes inherit from the RadControl classes. The closest common parent class for all of the Telerik controls I am inheriting from is ‘WebControl.’ The controls I am discussing all implement ICormantControl which doesn’t have much to it:

public interface ICormantControl<T>
{
    T GetSettings();
}

Now, in my helper class I have a handful of methods. I’d like to start with one that I believe I have the best chance of doing something with.

    /// <summary>
    /// Saves a control -- writing it to Session and the DB. 
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="control"></param>
    public static void Save<T>(ICormantControl<T> control)
    {
        T settings = control.GetSettings();
        string controlID = ((ISetting)settings).ID;

        SerializableDictionary<string, T> states = GetStates<SerializableDictionary<string, T>>();

        bool isKnown = states.ContainsKey(controlID);

        if (isKnown)
        {
            Logger.DebugFormat("{0} is known. Overwriting data.", controlID);
            states[controlID] = settings;
        }
        else
        {
            Logger.DebugFormat("{0} is unknown. Saving data.", controlID);
            states.Add(controlID, settings);
        }

        SetStates<SerializableDictionary<string, T>>(states);
    }

Currently, to save the state of a control, I call StateManager.Save<RadDockSetting>(dock), for example.

I believe a better implementation would result in me being able to say dock.Save().

As I see it I am pinned between a rock and a hardplace. I am under the impression that if I move the declaration of Save to my ICormantControl interface then I will have to move the implementation of Save to each of the controls which implement ICormantControl. This would result in a large amount of duplicated code.

Should I be leaving my implementation in my helper class, moving the declaration to ICormantControl, and then, in each class which implements ICormantControl, I redirect the implementation to my helper method?

As far as I can tell I am not able to have all of my controls inherit from an intermediary class. The common parent is too far up the hierarchy of inherited parent controls. It may be possible to extend WebControl and have it implement Save, but that seems orders of magnitude worse than my above suggestion.

Do I have other options?

  • 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-24T01:31:12+00:00Added an answer on May 24, 2026 at 1:31 am

    What you want is an extension method. Change your declaration to this:

    public static void Save<T>(this ICormantControl<T> control)
    

    Then you’ll be able to do dock.Save() without needing to modify the ICormantControl interface or any of the other classes.

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

Sidebar

Related Questions

I have develop small Asp.net MVC3 application using Telerik rad Controls with in that
I have an ASP.NET application using the Telerik Q1 2009 controls. I have a
I have a project I'm working on and I'm using the Telerik MVC controls.
We have two asp.net sites (based on episerver). Using Telerik Asp.net controls. We have
I am using Telerik ASP.Net Ajax controls (theoretically shouldn't matter who makes the 3rd
I have telerik controls on my page. I am making a vacation calendar using
I'm using Telerik's Grid control from the MVC Extensions. I have it set up
I am using telerik controls in my application. I have to change background colors
I am using Telerik Rad Controls for Silverlight that is intended to be used
I'm using Telerik's RadAjaxManager to update panels independently. On my page, I have 3

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.