views:

437

answers:

1

Hi guys,

is there a way to send multiple parameters to controller as one parameter?

for example, if I have route:

{controller}/{action}/{languages}

can parameter languages be array of strings? if it does, how to use it...how to send array to controller and how to parse it in controller method?

thanks Marko

+2  A: 

It may be worth you looking up Mvc.Net Model Binding. This is used to pass objects (rather than primitives) through to a controller simply by naming the fields you're sending with a common prefix.

Example here:

http://odetocode.com/Blogs/scott/archive/2009/04/27/12788.aspx

To create an array of objects, you'd name the fields Person[i].Surname, etc and it will build person objects for you and place it in an array, assuming the Controller action is set up to accept one.

Jimmeh