We are setting the selected menu root from code to help show end users what menu item they are on.
code (code used on all child menus of Parent)
If Not Page.IsPostBack Then
Dim rMnu As Telerik.Web.UI.RadMenu
rMnu = CType(Master.FindControl("FLSRadMenu"), Telerik.Web.UI.RadMenu)
If Not rMnu Is Nothing Then
rMnu.Items(1).Selected = True
End If
End If
Issue: a user can select another parent (root) menu item and this becomes "selected", when really the meny item set in code is still selected.
I want to be able to disable clicking on all root menu items.
Thanks in advance
code (code used on all child menus of Parent)
If Not Page.IsPostBack Then
Dim rMnu As Telerik.Web.UI.RadMenu
rMnu = CType(Master.FindControl("FLSRadMenu"), Telerik.Web.UI.RadMenu)
If Not rMnu Is Nothing Then
rMnu.Items(1).Selected = True
End If
End If
Issue: a user can select another parent (root) menu item and this becomes "selected", when really the meny item set in code is still selected.
I want to be able to disable clicking on all root menu items.
Thanks in advance
9 Answers, 1 is accepted
0
Accepted
Princy
Top achievements
Rank 2
answered on 30 Nov 2010, 08:08 AM
Hello,
You need to attach the "OnClientItemClicking" cleint event to RadMenu and check for whether the clicked item is rootitem. If so, cancel the event using the code " args.set_cancel(true) ".
Thanks,
Princy.
You need to attach the "OnClientItemClicking" cleint event to RadMenu and check for whether the clicked item is rootitem. If so, cancel the event using the code " args.set_cancel(true) ".
Thanks,
Princy.
0
Marc
Top achievements
Rank 1
answered on 30 Nov 2010, 10:49 PM
Solved!
Added the following code
<script type="text/javascript">
function OnClientItemClicking(sender, args) {
if (args.get_item().get_items().get_count() != 0 && args.get_item().get_level() ==0) {
args.set_cancel(true); // Cancel the event
}
}
</script>
and
OnClientItemClicking="OnClientItemClicking"
Added the following code
<script type="text/javascript">
function OnClientItemClicking(sender, args) {
if (args.get_item().get_items().get_count() != 0 && args.get_item().get_level() ==0) {
args.set_cancel(true); // Cancel the event
}
}
</script>
and
OnClientItemClicking="OnClientItemClicking"
0
rahul
Top achievements
Rank 1
answered on 03 Dec 2010, 07:15 AM
Hi,
I want to have rounded corners for my submenu items in Radmenu.
I m using a background image and skin is Default.
Please suggest me to do that and the changes in Css file.
I want rounded corners in bottom part only.
I want to have rounded corners for my submenu items in Radmenu.
I m using a background image and skin is Default.
Please suggest me to do that and the changes in Css file.
I want rounded corners in bottom part only.
0
Hello rahul,
RadMenu has rounded corners since Q1 2010 release - please set EnableRoundedCorners property to true in order to enable them.
Greetings,
Yana
the Telerik team
RadMenu has rounded corners since Q1 2010 release - please set EnableRoundedCorners property to true in order to enable them.
Greetings,
Yana
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Ron
Top achievements
Rank 2
answered on 21 Dec 2012, 08:05 PM
I have tried hooking into the OnClientItemClicking with the previously mentioned code, but when I do this, it still does not stop from applying the Selected CSS to the item. Is there anyway of canceling this affect from happening?
0
Hello, Ronald.
Selecting an item and preventing the decoration are two different things.
For instance, there are two class names that define the appearance of an item: one is rmSelected and the other is rmFocused. While you can effectively prevent the rmSelected class from ever being set, by setting the EnableSelection="false" e.g.
there is little you can do about the rmFocused class -- the class is set internally whenever an item receives focus. You could override it's behaviour e.g. appearance but that's about it.
Regards,
Ivan Zhekov
the Telerik team
Selecting an item and preventing the decoration are two different things.
For instance, there are two class names that define the appearance of an item: one is rmSelected and the other is rmFocused. While you can effectively prevent the rmSelected class from ever being set, by setting the EnableSelection="false" e.g.
<
telerik:RadMenu
runat
=
"server"
EnableSelection
=
"false"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"Item 1"
/>
<
telerik:RadMenuItem
Text
=
"Item 2"
/>
<
telerik:RadMenuItem
Text
=
"Item 3"
/>
<
telerik:RadMenuItem
Text
=
"Item 4"
/>
<
telerik:RadMenuItem
Text
=
"Item 5"
/>
</
Items
>
</
telerik:RadMenu
>
there is little you can do about the rmFocused class -- the class is set internally whenever an item receives focus. You could override it's behaviour e.g. appearance but that's about it.
Regards,
Ivan Zhekov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Ron
Top achievements
Rank 2
answered on 28 Dec 2012, 01:57 PM
Unfortunately, this does not work for my situation. I basically want to prevent the selected CSS from applying to the root level items when they are selected. The method you are showing me will prevent any selected CSS from applying at any level.
0
Hi Ron,
Try using the following css class selectors in a combination with the CssClass property of the RadMenuItems:
markup:
Note that if you use any skin that is different from the Default one you will need to change the name selector so it corresponds to the skin name.
All the best,
Kate
the Telerik team
Try using the following css class selectors in a combination with the CssClass property of the RadMenuItems:
div.RadMenu_Default .rmFirst a.rmLink.new,
div.RadMenu_Default .rmFirst a.rmLink.new:hover,
div.RadMenu_Default a.rmLink.new
1
,
div.RadMenu_Default a.rmLink.new
1:
hover,
div.RadMenu_Default a.rmLink.new
2
,
div.RadMenu_Default a.rmLink.new
2:
hover,
div.RadMenu_Default a.rmLink.new
3
,
div.RadMenu_Default a.rmLink.new
3:
hover,
div.RadMenu_Default .rmLast a.rmLink.new
4
,
div.RadMenu_Default .rmLast a.rmLink.new
4:
hover {
background-position
:
0
-407px
;
}
markup:
<
telerik:RadMenu
ID
=
"RadMenu2"
Skin
=
"Default"
runat
=
"server"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"Item 1"
CssClass
=
"new"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"Item 1"
/>
<
telerik:RadMenuItem
Text
=
"Item 2"
/>
<
telerik:RadMenuItem
Text
=
"Item 3"
/>
<
telerik:RadMenuItem
Text
=
"Item 4"
/>
<
telerik:RadMenuItem
Text
=
"Item 5"
/>
</
Items
>
</
telerik:RadMenuItem
>
<
telerik:RadMenuItem
Text
=
"Item 2"
CssClass
=
"new1"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"Item 1"
/>
<
telerik:RadMenuItem
Text
=
"Item 2"
/>
<
telerik:RadMenuItem
Text
=
"Item 3"
/>
<
telerik:RadMenuItem
Text
=
"Item 4"
/>
<
telerik:RadMenuItem
Text
=
"Item 5"
/>
</
Items
>
</
telerik:RadMenuItem
>
<
telerik:RadMenuItem
Text
=
"Item 3"
CssClass
=
"new2"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"Item 1"
/>
<
telerik:RadMenuItem
Text
=
"Item 2"
/>
<
telerik:RadMenuItem
Text
=
"Item 3"
/>
<
telerik:RadMenuItem
Text
=
"Item 4"
/>
<
telerik:RadMenuItem
Text
=
"Item 5"
/>
</
Items
>
</
telerik:RadMenuItem
>
<
telerik:RadMenuItem
Text
=
"Item 4"
CssClass
=
"new3"
/>
<
telerik:RadMenuItem
Text
=
"Item 5"
CssClass
=
"new4"
/>
</
Items
>
</
telerik:RadMenu
>
Note that if you use any skin that is different from the Default one you will need to change the name selector so it corresponds to the skin name.
All the best,
Kate
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Keith
Top achievements
Rank 1
answered on 22 Jun 2016, 03:35 PM
Hi Marc,
Your solution worked for me. Thanks!
Sincerely,
Keith Jackson