I'm trying find a way to do something with MVC that I was able to do with WebForms.
I have a set of steps a user needs to go through to fill in data. In a previous case it was registering animals on an 'classifieds' site that was designed in webforms. For simplicity lets say it has 3 pages. Page 1 asks them what type of animal in a dropdownlist. This would display [dog, cat, sheep, alpaca, horse]. On submitting the page the data would be saved and then transfered to the second page. On the second page they would be required to submit information specific to each animal. Rather than create one large page and hide/show the relevant controls for that animal, or having panel controls to group the data, I chose to create user controls for each animal. This control would inherit from an interface I created called IAnimalTemplate which contained two methods, Load() and Save(). Page two would contain only a placeholder control. I would then take the type of animal and then dynamically load the usercontrol into the placeholder. The magic of the IAnimalTemplate really came into effect when I clicked the submit button to save the data. The submit button was outside of the uer control so I was able to cast the user control to IAnimalTemplate and call the Save method. It worked brilliantly and allowed me to very quickly create numerous templates/user controls for differing animals and store/load the combinations in a database. Because it was the submit button in the page that called a method that then subcalled the Save method on the user control I was then able to continue processing from the page and transfer to page 3.
Now I need to do something very similar with MVC. I've looked into the Html.RenderAction from MVCFutures and have also looked at PartialRequests at http://blog.codeville.net/2008/10/14/partial-requests-in-aspnet-mvc/ but I'm really not sure if these will do the job. These seem to keep the viewmodel within the controls which is ideal because the model data changes between '(animal) templates' but they are going to call their own actions. Of course I can call a Save method which I can define in an interface BUT I'm not sure I can continue executing code outside of the view control (in the page) once this has been executed. Maybe I'm confused on this, I'm hoping someone can shine a light on a solution somewhere. Any ideas or do I need to expand some more?
Thanks Lloyd