highlight selected menu item problem?

2 posts, 0 answers
  1. Paul Huynh
    Paul Huynh avatar
    1 posts
    Member since:
    Jul 2009

    Posted 26 Jul 2009 Link to this post

     I am new with telerik control. Here is my problem below:
       I designed my site using vS 2008 prof.
       The menu item was designed in webcontrol page (menucontrol.ascx). This control was embeded to masterpage (masterpage.master).
    Default.aspx was created from masterpage.master.
       I want to highlight default.aspx page everytime user select on menu bar. I added the code below into my default.aspx.cs in Page_Load:

    protected void Page_Load(object sender, EventArgs e)
            string item = Server.UrlDecode(Request["0"]);
            if (!string.IsNullOrEmpty(item))
                 RadMenuItem currentItem = RadMenu1.FindItemByText(item);
                 if (currentItem != null)

    The problem is saying that "RadMenu1" does not exist in the current context. It's true, because the RadMenu1 was build inside Menucontrol.ascx page.
         I downloaded free trial

    ASP.NET AJAX Q1 SP1 2009

    Please help me to solve my issue.
    Thanks alot.
  2. Daniel Plomp
    Daniel Plomp avatar
    130 posts
    Member since:
    Feb 2004

    Posted 28 Jul 2009 Link to this post

    Hi Paul,

    Why not adding the RadMenu directly inside the masterpage?
    Then it is quite easy to reference it from the default.aspx page.

    Something like this:

    protected void Page_Load(object sender, EventArgs e) 
            if (!IsPostBack) 
                RadMenu menu = (this.Master as MasterPage).FindControl("RadMenu1"as RadMenu; 

  3. DevCraft R3 2016 release webinar banner
Back to Top