I’m dealing with a post from a javascript script on my page that is sending data to my action method in the format:
stuff[value1]=value1
stuff[value2]=value2
stuff[value3]=value3
…like a PHP hash. If I were programming this in PHP, I would retrieve the values into a hash by doing something like
$data = $POST['stuff']
Any way I can easily deal with this data in an ASP.NET MVC way? I have used a FormCollection parameter to my action method, and it captures data such that each key is like stuff[value1] and the value is value1. I can do that, but the real key is inside the [], and I would rather not have to parse out the real keys from strings. I’ve also tried
Dictionary<String, object> stuff
but that didn’t bind any data at all.
will be binded to:
Read this post for this kind of complex scenarios.