Posting int arrays to MVC controller - what would be the correct method signature?
Below is a screenshot of the POST request (using Firebug Net panel) I am sending to my ASP.NET MVC2 controller.
This is the controller / action method that receives the POST request:
pub开发者_Python百科lic ActionResult Search(int[] skill, int[] discipline, int[] education, int[] marketsector){ ... }
The parameters POSTed seem to me to be in the correct form, however the action method receives four null arguments. Could you please tell me what should the method signature look like on the server side? Or a better way of posting these four integer arrays to my MVC2 controller?
They could look like this:
<input type="text" name="discipline" value="6" />
<input type="text" name="marketsector" value="5" />
<input type="text" name="marketsector" value="7" />
<input type="text" name="marketsector" value="3" />
<input type="text" name="skill" value="3" />
<input type="text" name="skill" value="8" />
And here's a blog post you may take a look at. And a similar one.
精彩评论