This is a migrated thread and some comments may be shown as answers.

Disabled Menu Item that looks normal?

2 Answers 37 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Chris Mitchell
Top achievements
Rank 1
Chris Mitchell asked on 09 Sep 2010, 04:59 PM
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 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 10 Sep 2010, 02:50 PM
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.
0
Veronica
Telerik team
answered on 10 Sep 2010, 03:03 PM
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
Tags
Menu
Asked by
Chris Mitchell
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Veronica
Telerik team
Share this question
or