Problem with dynamic navigateURL

2 posts, 0 answers
  1. David
    David avatar
    11 posts
    Member since:
    Aug 2007

    Posted 14 May 2015 Link to this post

    We are using near-latest version of the product.  In our web site we have to display dynamically generated (via javascript) context menus.  We cannot generate them on the back-end because we don't know how many or what options there will be until the user takes certain actions.  However, each menu item  will come from the master menu-bar that is created on the back-end for the overall site.

    When the user takes action, we use javascript to determine which menu items from the master menu-bar are needed within the context menu.  For each item, we create a new item and add it to the context menu (ps - the context menu is declaratively created on our master page's html, albeit with no menu items):

    var newItem = new Telerik.Web.UI.RadMenuItem();
    var navUrl = mainItem.get_navigateUrl();


    The problem is, when the navigate url is rendered, it is total mangled.

    Here is an example link from the 'main' menu bar (which works perfectly):

    <a class="rmLink" style="width: 268px;" href="javascript:goDnetPage('attrition_total_exempt','4829','functions/reports/front_ends/pages/HRMetrics.aspx','Report=attrition_total_exempt') "><span class="rmText">Total Attrition</span></a>

    The 'value' of the href attribute, when assigned into the 'newItem' object is correct - we have console.logged it (via newItem.get_navigateUrl) and it is accurate.  However, when the menu item is rendered by the menu code, it comes out as:

     <a class="rmLink" href="javascript:goDnetPage(" '="" hrmetrics.aspx','report="attrition_total_exempt')" pages="" front_ends="" reports="" attrition_total_exempt','4829','functions=""><span class="rmText">Total Attrition</span></a>

    Something, I presume within the Telerik js, is totally munging up the href value, creating additional attributes for the 'a' element as it sees fit.  I have tried replacing/escaping single ticks and slashes, but cannot seem to get it to come out right.

     Any advice would be appreciated.  Thank you.

  2. Ivan Danchev
    Ivan Danchev avatar
    788 posts

    Posted 19 May 2015 Link to this post


    I am afraid, I was not able to reproduce the issue you are experiencing. I am attaching a sample project to this reply. It contains a RadMenu and a RadContextMenu. When we right click on the RadMenu we add a new Item to the RadContextMenu and we set its Text and NavigateUrl properties, the values of which we get from one of the RadMenu Items. At my side this works as expected and the url is correctly set to the anchor element's "href" attribute as well.

    Could you please try to reproduce the issue you are having in the sample project and post your modifications, so we can investigate further the possible cause for the behavior you noticed?

    Ivan Danchev
    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 Feedback Portal and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
Back to Top