I realize that a whole lot of code cannot fit here, but I am asking for general direction or pointer.
I have .NET user controls nested six deep for an interactive gadget with (outer to inner) of : wrapper, tabs, panels, lists, rows, items.
I am trying to get a reference to an ancestor control from a nested control.
Specifically, I have this code in the code behind of a embedded "great great grand child" control. It works, but it is very ugly:
MyTab _myTab = this.Parent.Parent.Parent.Parent.FindControl(thisTab) as MyTab;
which equals {ASP.controls_appname_widget_mywidget_mytab_ascx}
and is correct.
I realize that I can do something like Page.FindControl("MyWrapper:MyPanel:etc.....) but that is not recommended either, since structure or IDs can change....
Is there a decent alternative?