locked
Call a method in a UserControl on a masterpage RRS feed

  • Question

  • User710316116 posted

    I have a masterpage, and from one of the content containers I want to call a method on a UserControl contained within the masterpage.  I'm really rather stuck. The method is public within the usercontrol codebehind file. The partial class is called 'menu'.

    I'm thinking it's something like:

    Menu eunMenu = (menu)Master.FindControl("eunMenu");

    eunMenu.BuildAppSpecMenu("Members");

    but it doesn't seem to be working. Please help./

    Thanks

    Rich

    Wednesday, August 9, 2006 12:29 PM

All replies

  • User210071364 posted

     Rather late on a response, but I figure this might help anyone else coming along later...

    - Make sure that whatever you're casting to (menu) includes the namespace.

    - I used Page.Master.FindControl.  Not sure that makes a difference, but worth a try.

    - I'm developing in a Web Application instead of a Web Site.  Might matter.

     An example of what I used:

    _includes.TopMenu menucontrol = (_includes.TopMenu)Page.Master.FindControl("TopMenu1");

     

    Hope it helps.

     

    Thursday, June 26, 2008 10:17 AM