• 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:

this.FavoritesTree.UltraWebTreeFavorites

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

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

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

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

Thanks!
0

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