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

[Solved] MVC Menu: Capture selected item in Controller

3 Answers 36 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Shaun
Top achievements
Rank 1
Shaun asked on 05 Jun 2012, 04:55 PM
Would please offer an example in vb.net of how to capture the selected item for mvc menu in an existing controller. I've seen the examples for client side capture but not sure how to get this to my server side/controller. Thanks

3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 06 Jun 2012, 08:06 AM
Hi NK,

The Menu has no built-in mechanism to submit data to the server, so you need to do this manually. Add a form with a hidden field to the page and populate the field in the OnSelect event with any information that you will need.

Kind regards,
Dimo
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
0
Shaun
Top achievements
Rank 1
answered on 06 Jun 2012, 06:53 PM
Thanks for your answer.  However, i realized what i need to do is just route to an action in controller:

             @(Html.Telerik().Menu() _
                .Name("ToolsMenu") _
                .Items(Function(items)
                               items.Add().Text("Export to CSV").Action("ExportToCSV", "Home")
                       End Function) _
                 .Render()

Is this the correct syntax for adding an action link to menu item in VB.NET. I get a syntax error: "Expression does not produce a value"

Thank you.
0
Dimo
Telerik team
answered on 07 Jun 2012, 08:35 AM
Hi Nik,

Using an Action for the item is a viable approach as well.

However, you can't use @( ) code blocks with a Render() statement.

http://forums.asp.net/t/1694834.aspx/1

Regards,
Dimo
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now.
Tags
General Discussions
Asked by
Shaun
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Shaun
Top achievements
Rank 1
Share this question
or