More in this section

Forums / Developing with Sitefinity / Pure CSS RadMenus that DON'T throw JS errors

Pure CSS RadMenus that DON'T throw JS errors

7 posts, 1 answered
  1. Aaron P
    Aaron P avatar
    5 posts
    Registered:
    18 Feb 2010
    18 Feb 2010
    Link to this post
    I'm currently working on a Sitefinity site that needs to use pure CSS for the dropdown menus and not RadMenu's Javascript animation, so I set EnableEmbeddedScripts="false"

    <telerik:RadMenu ID="RadMenuHeader"
                DataSourceID="SiteMapDataSourceHeader" 
                EnableEmbeddedSkins="false"
                EnableEmbeddedBaseStylesheet="false"
                EnableEmbeddedScripts="false"
                Flow="Horizontal"
                runat="server"
                OnItemDataBound="RadMenuHeader_ItemDataBound" />

    When I do this, I get the Javascript error "Telerik is not defined" on every page load, and in the admin area I get a "c is undefined" JS error when I try to Edit a content section. Setting EnableEmbeddedScripts="true" fixes both problems, but obviously disables my CSS dropdowns with its Javascript.

    Any help someone can offer would be greatly appreciated.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    18 Feb 2010
    Link to this post
    Hello Aaron P,

    You can disabled the scripts only in case you have your custom scripts that you can use to replace the default one. Please refer to Disabling embedded resources

    Kind regards,
    Ivan Dimitrov
    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. Aaron P
    Aaron P avatar
    5 posts
    Registered:
    18 Feb 2010
    18 Feb 2010
    Link to this post
    Ivan, thanks for the fast reply.

    So there is no way to use only CSS to do my menu dropdowns? I have to use some sort of Javascript, whether it be the default scripts or my own custom scripts? Am I understanding this correctly?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    18 Feb 2010
    Link to this post
    Hello Aaron P,

    You can use client side API of RadMenu control for ASP.NET AJAX to disable the events you do not want to use.

    Sincerely yours,
    Ivan Dimitrov
    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.
  5. Aaron P
    Aaron P avatar
    5 posts
    Registered:
    18 Feb 2010
    18 Feb 2010
    Link to this post
    Hi Ivan,

    Forgive my ignorance. It does appear that the Client Side API is what I will need to modify, but would I do this on the OnClientLoad or the OnClientMouseOver?  It seems like it would be more efficient to disable hovering on OnClientLoad to prevent a JS call each time a menu is rolled over.

    Could you possibly provide a quick code example of how to disable the drop down effect of the RadMenu using the Client Side API?  It would really help.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    18 Feb 2010
    Link to this post
    Hello Aaron P,

    You need to disable item opening

    function OnClientItemOpening(menu, args) {
        args.set_cancel(true);
    }

    <telerik:RadMenu  ID="RadMenu1"  OnClientItemOpening="OnClientItemOpening" runat="server"  DataSourceID="SitemapDataSource1" OnItemDataBound="RadMenu1_ItemDataBound">
    </telerik:RadMenu>


    Greetings,
    Ivan Dimitrov
    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.
    Answered
  7. Aaron P
    Aaron P avatar
    5 posts
    Registered:
    18 Feb 2010
    18 Feb 2010
    Link to this post
    Ivan, you are the man. Thanks.
Register for webinar
7 posts, 1 answered