SaaS CMS has officially launched! Learn more now.

Find control in usercontrol from usercontrol

I'm creating a new ascx usercontrol placed in the DefaultFramework masterpage. How do I access the PageTreeControl located in Menu.ascx from the codebehinde. Best Regards /Tomas
Jul 05, 2005 16:26
Hi Thomas! You can either create a Property in your usercontrol which sets the PageTreeData for your control. The Page or the Frameset can set this as it already knows about the data for the Menu. or you can use the Page.FindControl(idOfControlToFind) method for the page to find the Menu control (you have access to the Page object in your ascx codebehind). This is somewhat slower as the Page must search in it's controlhierarchy. Cast the found control to a Menu object and you can use it's FindControl() method to find the PageTreeControl. I would go for the first solution :)
Jul 05, 2005 17:00
I have the same problem. Can you give any code examples? I want to set the datasource for my second level menu pagetree to be my topmenu menulist.
Jul 14, 2005 14:55
There is an example of how this can be done in the sample templates. The framework is responsible to set a property for the MenuList control that is used by the level 2 PageTree. private void Page_Init(object sender, System.EventArgs e) { if(TopMenu != null && LeftMenu != null) LeftMenu.MenuListControl = TopMenu.MenuListControl; }
Jul 25, 2005 17:35
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.