Disabled Menu Item that looks normal?

3 posts, 0 answers
  1. Chris Mitchell
    Chris Mitchell avatar
    15 posts
    Member since:
    Oct 2009

    Posted 09 Sep 2010 Link to this post

    I have a RadMenu that uses sub-items in a variety of places. What I would like to do is have the items that have children not be clickable themselves (since they exist only for categorization purposes). I tried just making that item .Enabled = false but that caused it to shift in appearance which I do NOT want.. I couldn't seem to get the DisabledCSSStyle property to work with this..

    Is there an easy way to do this? If it matters, I am building my menus dynamically..
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 10 Sep 2010 Link to this post

    Hello,

    Add the "!important" keyword in the style in order to override the default style of RadMenu.

    CSS:
    <style type="text/css">
        .disabledItem
        {
            color:Black !important;
        }
    </style>


    aspx:
    <telerik:RadMenuItem runat="server" Text="City">
         <Items>
          <telerik:RadMenuItem Enabled="false" DisabledCssClass="disabledItem" runat="server" Text="Ohio">
          </telerik:RadMenuItem>


    Thanks,
    Princy.
  3. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 10 Sep 2010 Link to this post

    Hi Chris Mitchell,

    You can subscribe to the OnClientItemClicking event and check if the current clicked item has children. If yes - the event will be cancelled. Here's a sample code:

    function clientItemClickingHandler(sender, args) {
                var item = args.get_item();
                if (item.get_items().get_count() != 0) {
                    args.set_cancel(true);
                }
                else {
                    alert("item is clicked");
                }
            }

    Hope this helps.

    Regards,
    Veronica Milcheva
    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
Back to Top