1

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

1
  • I expect the key phrase you are looking for here is "model binder" - however, I don't know the specifics of working with arrays, so I won't attempt to post as an answer... Commented Apr 28, 2009 at 8:09

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.