tags:

views:

24

answers:

1

I have such scenario when i have to load controls dynamically. I have untyped view and a set of strong typed controls. All strong typed controls has completely different models.

The questions is, how to create kind of generic post action method wich allows to get all this models on post?

May be some one may suggest the more efficient way of doing this? Load controls dynamically (kind of wizard, prev/next) and then catch data on post action.

I just was thinking that i may have post action for each step for each model. I will try it now.

Any more ideas are welcome :)

A: 

Assuming you can determine from the request what models you created for edit, you could just recreate those objects and call UpdateModel() on each one.

Of course, you'll need to make sure the fields names don't overlap between the object types.

Also, you'll need to look at the implications of using dynamic objects in UpdateModel(). To get around the limitations look at the code I posted here:

http://stackoverflow.com/questions/3257867/mvc-2-updatemodel-on-interface-should-modelbinderattribute-be-ignored

jwsample