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

[Solved] Add a css class to one menu item?

1 Answer 44 Views
Menu
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Michael McGovern
Top achievements
Rank 1
Michael McGovern asked on 30 May 2010, 01:14 PM
I am converting an HTML menu and I have a menu item that does nothing more than call a javascript.
The old item looks like
<href="#" class="getdirections">Directions</a> 
.
Is it possible to append a class to a single top level menu item and have the url as # ?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 31 May 2010, 06:24 AM
Hello Michael McGovern,

You can use the LinkHtmlAttributes method to set the attributes of the <a> tag output by the menu:

items.Add().Text("test").LinkHtmlAttributes(new {@class="someclass"})

Use NavigateUrl to set the url of the item.

Regards,
Atanas Korchev
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
Michael McGovern
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or