Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have one aspx page and two user controls. I have a tree view in one user control. what i want to do is that when i click a button in user control 2 i must find the tree view in user control 1 and expand it. Am new to aspx, pls help me out.. thanks in advance
Posted
Comments
Krunal Rohit 6-Mar-14 7:59am    
Any efforts so far ?

-KR
Arjun Menon U.K 6-Mar-14 23:30pm    
Hi krunal, i tried creating a property in the user control that has tree view and tried to access that using the User Control's object. But the problem is that the class is not public. The point shelby specified below do crossed my mind, but as I said the class is not public. I think I have to make it public and try the way Shelby specified below.

1 solution

In user control 2...

var treeview = (TreeView)this.Page.FindControl("MyTreeViewID");

Something like that should work.
 
Share this answer
 
Comments
Arjun Menon U.K 6-Mar-14 23:31pm    
Hi shelby
I tried creating a property in the user control that has tree view and tried to access that using the User Control's object. But the problem is that the class is not public. The point you specified did cross my mind, but as I said the class is not public. I think I have to make it public and try it.
Arjun Menon U.K 6-Mar-14 23:34pm    
The two user controls are within another user control which also has the tree view.So this.Parent.FindControls("xxxx"), it should get the control rt???
Shelby Robertson 6-Mar-14 23:49pm    
Yeah that should get the control.
Arjun Menon U.K 7-Mar-14 8:39am    
thanks i got it...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900