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

[Solved] Declare Menu Item to Work with Controller and Action Name

1 Answer 64 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.
Hardy Wang
Top achievements
Rank 1
Hardy Wang asked on 26 Feb 2011, 05:51 PM
Hi all,

Let's say I declare menu in this way, other than I add menu item by using item.Add().Text("Menu Item Name").Url("aaa"); to specify Url directly, is there a way I can specify controller and action name instead?

<%

Html.Telerik().Menu()

.Name(

 

"MainMenu"

)

 

 

 

})

.Items(items =>  

{

items.Add().Text(

 

"Root 1"

)

 

 

 

.Items(item =>

{

item.Add().Text(

 

"Sub 1 - 1"

);

 

 

 

item.Add().Text(

 

"Sub 1 - 2"

);

 

 

 

});

items.Add().Text(

 

"Root 2"

)

 

 

 

.Items(item => 

{

item.Add().Text(

 

"Sub 2 - 1"

);

 

 

 

item.Add().Text(

 

"Sub 2 - 2"

);

 

 

 

});

 

 

}).Render();

%>

Thanks
Hardy

1 Answer, 1 is accepted

Sort by
0
Hardy Wang
Top achievements
Rank 1
answered on 26 Feb 2011, 06:00 PM
OK, I found it by using:

item.Add().Text(

 

"Item Name").Action("ActionName", "MyController");

 

Tags
Menu
Asked by
Hardy Wang
Top achievements
Rank 1
Answers by
Hardy Wang
Top achievements
Rank 1
Share this question
or