I have created an usercontrol that has treeview inside.
Now I have placed it in an aspx page twice with some different Id let us say usercontrolA and usercontrolB.
Both of them are loaded in to page one by one.
Now in pre-render event of usercontrolA I want to get the object of treeview control of usercontrolB.
How can I achieve it?
You need to have the instance of
usercontrolBto access thetreeviewcontrol for both the user controls. So try preserving the instance in some appropriate storage to access it in thepre-renderevent.Introduce a property to hold the UC Type inside the
User-Control:In the parent ASPX set the property with
usercontrolB:Now you can use the
MainUserControlproperty to access yourTreeView: