tags:

views:

1017

answers:

3

I'm hoping that it isn't to pass each as a parameter to the controller post method..

Have a grid of 52 text boxes representing weeks in a year, each will be containing a decimal value, need ALL of these passed back to the controller for mass updating of the database..

edit: Adding more details.

So my action Index(); returns a view with a list of 52 objects in it.

so

return View(dates);

inside the view I do a foreach for all the objects of that type in the model, and put their values into textboxes, I then want to change them and hit submit.

is there any way to get the updated list into my POST controller without having to give it 52 parameters with the id's of the textboxes?

Thanks a lot in advance!

edit: Maybe there is a way I can post the forum to the controller and iterate through the textbox controls and get out id/value, any idea how?

A: 

Hey, I got the solution I wanted after a bit of messing about. I just passed in the parameter "FormCollection myForm" and after a bit of exploring within that object I found my 52 values! Thanks for the help.

edit: I deleted this due to peer pressure probably over a year ago... but looking back on it I don't see what the problem was, aside from answering my own question..

Shahin
+1  A: 

Check out this question. It should provide you with a better answer than using the FormCollection.

http://stackoverflow.com/questions/231878/complex-model-binding-to-a-list

Schotime