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

[Solved] Add a class style on a item created on client side

3 Answers 126 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Eduardo
Top achievements
Rank 1
Eduardo asked on 14 Jun 2009, 01:11 AM
Hi,

I am creating a menu all in the client side. Is there a way to add a custom class style to certain RadMenuItems? There may be a way to do it without worrying about adding a class name to the RadMenuItem.

What I want is the first layer to appear with a custom class style (different bgColor), while the sub-menus use the normal styles. It is a breadcrumb menu, the first layer is horizontal and for each breadcrumb there is a menu which lists all options for the next level. It looks a bit like the following:

test 1 > test 2 > test 3
menu test 1 1
menu test 1 2
menu test 1 3

Then each test item has a menu. I want that the test items have a different bg color than the menus, which will use one of the default styles (outlook in my case).

Thanks,
Eduardo

3 Answers, 1 is accepted

Sort by
0
Eduardo
Top achievements
Rank 1
answered on 14 Jun 2009, 02:13 AM
Hi,

I just got what I needed. I changed the style for the .rmRootGroup and it worked.

However, that is still a valid question. Is there a way to change the style class name of a RadMenuItem from the client side? Specially for a menu that was created on the client side.

Thanks,
Eduardo
0
Peter
Telerik team
answered on 16 Jun 2009, 04:53 PM
Hello Eduardo,

While possible to set css styles to menu items via javascript, we recommend you use css via a custom skin to achieve your goal of settting different background to root and child items. Here is a nice tutorial on creating a custom skin:
http://www.telerik.com/help/aspnet-ajax/menu_appearancecreatingacustomskin.html

Also, you might find the following topics helpful as well:

http://www.telerik.com/help/aspnet-ajax/menu_appearancecssfile.html

http://www.telerik.com/help/aspnet-ajax/menu_appearancecssselectors.html



All the best,
Peter
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Eduardo
Top achievements
Rank 1
answered on 18 Jun 2009, 11:24 PM
Hello Peter,

Yes, that is exactly what I am trying to do. What I want actually is to add a class name to the first level of the menu, so I can specify that class to display differently than any other layer. Then on the custom skin, I will define that class to have a different presentation than the others.

Thanks,
Eduardo
Tags
Menu
Asked by
Eduardo
Top achievements
Rank 1
Answers by
Eduardo
Top achievements
Rank 1
Peter
Telerik team
Share this question
or