RadMenu, Masterpage and ContentPlaceHolder Page

6 posts, 0 answers
  1. Patrick Williams
    Patrick Williams avatar
    8 posts
    Member since:
    Aug 2009

    Posted 17 May 2010 Link to this post

    Hi All,

    Could someone help me in understanding how to determine which radmenu item was clicked/selected from a page using master page. I'm trying to get the selectedvalue of that menu item to save to a database and also to determine  which user control to populate on the page.

    That is, my radmenu is on my master page and from any page in the application i would like to determine which radmenu item were selected.

    Thanks in advance for your response.
    Patrick.
  2. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 19 May 2010 Link to this post

    Hello Patrick,

    You can use SelectedItem property of the menu, because you open a new page and there's a different instance of the menu from the previous page.

    I suggest you use the following approach to find the clicked item and select it:

    RadMenu menu = (RadMenu)Master.FindControl("RadMenu1");
    RadMenuItem currentItem = menu.FindItemByUrl(Request.Url.PathAndQuery);
    if (currentItem != null)
       currentItem.Selected = true;


    Best regards,
    Yana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Patrick Williams
    Patrick Williams avatar
    8 posts
    Member since:
    Aug 2009

    Posted 27 May 2010 Link to this post

    Hi Yana,

    The method suggested I cannot use, because some of the page called by navigationUrl will be the same the only difference on this page is that I want to get the selectedValue to determine which User Control to load on that page.

    I know i can pass the value that i want with a query string through the navigationUrl but i dont want this value to be visible to ensure adequate  security. I tried also using javascript to get the selectedValue but this was not successful as well. The function "get_selectedItem()" seems to be not working, it does not give me any result.
  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 02 Jun 2010 Link to this post

    Hello Patrick,

    The other option is to save the value of the selected item in a session variable and after the postback get it from there.


    Best wishes,
    Yana
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. Ravi
    Ravi avatar
    1 posts
    Member since:
    Nov 2014

    Posted 10 Mar 2015 in reply to Yana Link to this post

    Hi Yana,

    Can you please Let me know what is Master in
    RadMenu menu = (RadMenu)Master.FindControl("RadMenu1"); Its throwing error for me
  7. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 13 Mar 2015 Link to this post

    Hello,

    Master gets a reference to the Master page object. If you are not using a master page in your web site/application the Master will return null. In case calling the FindControl method will throw an error since the object is null. 

    Regards,
    Boyan Dimitrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017