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

[Solved] Specifying controller and action adds t-state-selected class to list items

0 Answers 62 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.
Cory Deppen
Top achievements
Rank 1
Cory Deppen asked on 07 Jan 2011, 05:50 AM
When adding list items that contain hyperlinks to a menu, I initially tried using the Action method:

item.Add().Text("Item 1").Action<TestController>(action => action.Index())

However, I noticed this adds the "t-state-selected" class to the list items, which changes the background. I then tried to use the Url method but had the same results:

item.Add().Text("Item 1").Url(Url.Action(MVC.Test.Index())); // T4MVC used to define ActionResult

Lastly, I tried passing a simple string to the Url method and I was finally able to generate the menu without adding the "t-state-selected" class on the list items:

item.Add().Text("Item 1").Url("http://www.telerik.com");

Interestingly, if I specify "HighlightPath(false)" on the menu and specify a controller and action to define the URL, the "t-state-selected" class is not added to the list items and the menu is rendered as I would expect.

Can you confirm this behavior and if there is a preferred way to set list items that contain hyperlinks if this is not considered a bug?
Tags
Menu
Asked by
Cory Deppen
Top achievements
Rank 1
Share this question
or