• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 458
  • Last Modified:

Getting to controls inside a user control?

I have a web user control with a control on it.

At design time I can only seem to get to the control this way:

Node n = ((UltraWebTree)this.FavoritesTree.FindControl("UltraWebTreeFavorites")).SelectedNode;

this.FavoritesTree is the name of the Web User Control

"UltraWebTreeFavorites" is the ID of a control that is part of the Web User Control.

I'd rather just do this:


or something ... but I can't seem to do that
Tom Knowlton
Tom Knowlton
  • 2
1 Solution
Are you able to modify the user control?

If so you can expose the child control as a property of the user control.
Example of a Property which exposes a label called Label1: -

    public Label MyLabel
        get { return Label1; }
        set { Label1 = value; }
Tom KnowltonWeb developerAuthor Commented:

I'll have to try that when I get into work this morning.


Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now