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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:50:20+00:00 2026-05-23T04:50:20+00:00

I have developed a web dashboard which has a structure of controls embedded inside

  • 0

I have developed a web dashboard which has a structure of controls embedded inside of controls. In many scenarios I have the ID of a control and need to be working on the actual control object. As such, I use a utility method, a recursive FindControl implementation, which searches Page (or any other provided object, but I always use Page), for the ID of the control.

/// <summary>
/// Page.FindControl is not recursive by default.
/// </summary>
/// <param name="root"> Page </param>
/// <param name="id"> ID of control looking for. </param>
/// <returns> The control if found, else null. </returns>
public static Control FindControlRecursive(Control root, string id)
{
    if (int.Equals(root.ID, id))
    {
        return root;
    }

    foreach (Control control in root.Controls)
    {
        Control foundControl = FindControlRecursive(control, id);

        if (!object.Equals(foundControl,null))
        {
            return foundControl;
        }
    }

    return null;
}

This function has the ability to become quite slow. I realize just how slow once I put log4net logging into it. I am now trying to move away from it where I can, but I am not sure what other options I have, if any.

For instance, the user drag-and-drops a control onto my web page. The event handler looks like this:

protected void RadListBox_Dropped(object sender, RadListBoxDroppedEventArgs e)
{
    //e.HtmlElementID is the UniqueID of the control I want to work upon.
    RadDockZone activeControlDockZone = Utilities.FindControlRecursive(Page, e.HtmlElementID) as RadDockZone;
}

There is no guarantee that this control will be the direct child of Page, and I do not (as far as I know!), have the ability to determine where in my controls this ID could be except by searching from Page downward.

The only thing I can think up is keeping a lookup table of every object on Page, but that seems like the wrong idea.

Has anyone else experienced this issue?

  • 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-23T04:50:21+00:00Added an answer on May 23, 2026 at 4:50 am

    Hrm, how about this … The HtmlElementID should be the Client ID of the control which should hopefully be the fully qualified location of the control.

    Something like this:

    Page_Parent_0_Control_1

    You could break up the ID string and then navigate from the page down to the control in question by piecing together the path to it.

    Page findcontrol Page_Parent (index #0)
    Page_Parent_0 findcontrol Page_Parent_0_Control (index #1)

    Still not the best way but it would save you from doing a shotgun search for the control in question.

    Hopefully this will work for you or at least give you another way of looking at the problem 🙂

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

Sidebar

Related Questions

I am developing a web application which has Chart Controls. I have developed a
I have created a web service which has a couple of methods developed using
I have developed many web applications in ASP.NET in which I have make use
I have a web application developed with ASP.net and C# that is running on
I have a web project that I developed where one of the main functions
I have two web applications and both are developed in ASP.NET. Now I want
I am a web-developer working in PHP. I have some limited experience with using
We have developed a .NET web application that uses SQL Server as a backend.
I have developed web applications using JSF (myfaces components). But in these days of
I have developed web applications for a couple of years with ASP.NET Webforms and

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.