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

The Archive Base Latest Questions

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

I have controls being dynamically added and recreated on a web dashboard. I have

  • 0

I have controls being dynamically added and recreated on a web dashboard. I have been attempting to reduce my usage of Page.FindControl; I found it to be slow with large amounts of dynamically created content on Page.

In my attempts, I created a RegenerationManager singleton which is now in charge of regenerating my dynamic content. Whenever it regenerates an object, it stores the object in a list. This manager keeps several of these lists based on type of object.

Later, when I need to fetch an object by ID, I go to my regeneration manager to retrieve the object.

E.G:

public class RegenerationManager
{
    private static readonly ILog Logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

    private static readonly RegenerationManager instance = new RegenerationManager();
    private RegenerationManager() { }

    public static RegenerationManager Instance
    {
        get { return instance; }
    }

    public List<CormantRadPane> RegeneratedPanes = new List<CormantRadPane>();
    public List<CormantRadDockZone> RegeneratedDockZones = new List<CormantRadDockZone>();

    /// <summary>
    /// Recreates all the dynamically made DockZones.
    /// </summary>
    public void RegenerateDockZones()
    {
        Logger.Info("Regenerating dock zones.");
        foreach (KeyValuePair<string, RadDockZoneSetting> dockZoneState in RadControlManager.GetStates<SerializableDictionary<string, RadDockZoneSetting>>())
        {
            try
            {
                RadDockZoneSetting dockZoneSetting = dockZoneState.Value as RadDockZoneSetting;
                Logger.Info(String.Format("Loading state data for dock zone with setting ID: {0}", dockZoneSetting.ID));
                CormantRadDockZone dockZone = new CormantRadDockZone(dockZoneSetting);
                RegeneratedDockZones.Add(dockZone);
                CormantRadPane pane = RegeneratedPanes.First(regeneratedPane => regeneratedPane.ID == dockZoneSetting.ParentID);
                pane.Controls.Add(dockZone);
            }
            catch (Exception exception)
            {
                Logger.ErrorFormat("Error regenerating dock zones. Reason: {0}", exception.Message);
            }
        }
    }
}

/// <summary>
/// Creates the RadDock + Contents when dropping a graph onto the page.
/// </summary>
/// <param name="sender"> The RadListBox with an element being dropped from inside it. </param>
/// <param name="e"> Information about the drop such as target and what is being dropped. </param>
protected void RadListBox_Dropped(object sender, RadListBoxDroppedEventArgs e)
{
    CormantRadDockZone dockZoneOld = Utilities.FindControlRecursive(Page, e.HtmlElementID) as CormantRadDockZone;
    CormantRadDockZone dockZone = RegenerationManager.Instance.RegeneratedDockZones.First(regeneratedDockZone => regeneratedDockZone.ID == e.HtmlElementID);

    if (!object.Equals(dockZone, null) && !dockZone.Docks.Any())
    {
        RadSlidingPane slidingPane = ((sender as RadListBox).Parent as RadSlidingPane);
        CormantReport report = new CormantReport(int.Parse(e.SourceDragItems[0].Value), e.SourceDragItems[0].Text, slidingPane.Title);
        CormantRadDock dock = new CormantRadDock(report);
        dock.CreateContent();
        dockZone.Controls.Add(dock);
    }
}

Now, I thought this was a pretty good solution, but upon testing I found that the CormantRadDock being added to dockZone does not show up on my web dashboard, but if I added it to dockZoneOld that it does.

Looking at the two objects I did not notice any properties different about the two, but obviously there is something.

Is my idea possible to implement?

EDIT: I suspect the problem is with Telerik’s controls. I have an idea I’ll report back in a bit.
EDIT: It was indeed a Telerik thing. I needed to go through their RadDockLayout.RegisteredDockZone’s list instead of keeping my own managed one.

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

    The key thing to do here is debug your code and put a breakpoint on this line:

    CormantRadDockZone dockZone = RegenerationManager.Instance.RegeneratedDockZones.First(regeneratedDockZone =>regeneratedDockZone.ID == e.HtmlElementID);`
    

    Then do a quickwatch on the contents of RegenerationManager.Instance.RegeneratedDockZones to see if that list has any elements at in it. So here we’re checking the basics – does the list have any items in it at all?

    If there are items in there, you need to figure out why the specific element your looking for is not in the list. The list must be working, as there are items in there, but this specific element has not been added.

    If you’re 100% that the element is being added to the list, then it could be something to do with the singleton pattern your using. To be honest, it looks OK to me, but I’m no expert on the singleton design pattern.

    Sorry I can’t be of more help.

    EDIT:

    One thing which might help is to refactor the class a little bit:

    private IList<CormantRadPane> _regeneratedPanes;
    private IList<CormantRadDockZone> _regeneratedDockZones;
    
        public IList<CormantRadPane>  RegeneratedPanes
        {
            get
            {
            if(_regeneratedPanes == null)
                    {
                        _regeneratedPanes = new List<CormantRadPane>()
                    }
    
                    return _regeneratedPanes
                }
            }
    
            public IList<CormantRadDockZone> RegeneratedDockZones
            {
                get
                {
                    if(_regeneratedDockZones == null)
                    {
                        _regeneratedDockZones = new List<CormantRadDockZone>()
                    }
    
                    return _regeneratedDockZones
                }
            }
    

    Here I’m using properties to return the lists, rather then giving people direct access to the list members.

    This could help you with debugging your code.

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

Sidebar

Related Questions

I have a page with user controls getting dynamically added. Inside some of these
Have a page that adds controls dynamically. Control state is being retrieved from database
I have a web application that dynamically creates a web page using usercontrols. Within
I have a page with some dynamically added buttons. If you click a button
I have some javascript code that loads images dynamically in a web page: imageSrc
I have a dynamically created button that is being added to an update panel
I have an aspx page that dynamically loads user controls: there is an UpdatePanel
I have a user control which is being loaded to the page dynamically after
I have a ASPX Page that contains several user controls, which are loaded dynamically
I have a dynamically created TextBox in a C#/ASP.NET web page that I want

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.