working with a MVC4 application, and trying to get the menu to render.
I've tried the following code, which works fine:
@(Html.Kendo().Menu()
.Name("menu")
.Items(items =>
{
items.Add().Text("Item 1");
items.Add().Text("Item 2");
}
)
)
how can I set properties other than Text? I would like to be able to reference events by the menu item ID, which I can't seem to set through the html Helpers.
I've tried the following code, which works fine:
@(Html.Kendo().Menu()
.Name("menu")
.Items(items =>
{
items.Add().Text("Item 1");
items.Add().Text("Item 2");
}
)
)
how can I set properties other than Text? I would like to be able to reference events by the menu item ID, which I can't seem to set through the html Helpers.
5 Answers, 1 is accepted
0
Lee
Top achievements
Rank 1
answered on 06 Jul 2012, 04:04 PM
I too would like this wisdom. I am new to this toolkit and razor and would love some enlightenment!
Kind Regards,
Lee
Kind Regards,
Lee
0
xclirion
Top achievements
Rank 1
answered on 20 Jul 2012, 12:25 PM
Hi,
as far as i know different properties are joined together in Razor with a ".".
So this works:
As you can see there's at least a property "Url" which contains the target of the menu entry. I don't know if you can specify the controller separately. For the standard routing you can use "controller/action".
Hope this helps,
Michael
as far as i know different properties are joined together in Razor with a ".".
So this works:
items.Add().Text("Home").Url("Home/About");
As you can see there's at least a property "Url" which contains the target of the menu entry. I don't know if you can specify the controller separately. For the standard routing you can use "controller/action".
Hope this helps,
Michael
0
Lee
Top achievements
Rank 1
answered on 20 Jul 2012, 12:28 PM
Thanks Michael,
I'll give that a go!
Lee.
I'll give that a go!
Lee.
0
xclirion
Top achievements
Rank 1
answered on 20 Jul 2012, 12:40 PM
Hi Lee,
In the sample project I have seen, there seems at least one additional parameter "Enabled".
Unfortunately the documentation for the ASP.net MVC Wrapper seems not to be ready / published.
Michael
In the sample project I have seen, there seems at least one additional parameter "Enabled".
items.Add().Text("News").Enabled(false);
Unfortunately the documentation for the ASP.net MVC Wrapper seems not to be ready / published.
Michael
0
Samuel
Top achievements
Rank 2
answered on 08 Nov 2012, 08:29 PM
There is also a .Action, which works well for actions. The only issue I have with it is that it doesn't work quite the same way as the razor helper. Namely, you can't include the link text with the .Action - you have to use a separate .Text() for that.