Thursday 23 February 2012

Openrasta : Binding arrays / enumerables from form data

In ASP.NET MVC if you submit a form that looks like :

myarr[0]=11111&myarr[1]=22222

Then a controller that takes IEnumerable will have the form data parsed in successfully.

Looks like the default binder in Openrasta behaves a bit differently. You need to format your form data like this instead :

myarr:0=11111&myarr:1=22222

This works with posting/putting arrays of objects as well (ie myarr:0.Name=Dave), aswell as being supported in posting/putting models which contain arrays within them

No comments:

Post a Comment