Reputation: 4084
So I've return View(object);'d, and I press submit on that page, how do I get that object back in the controller? any ideas?
my viewpage is
public partial class Index : ViewPage<List<Models.Pricing>>
and
public ActionResult Index(int id, FormCollection datesForm,
[Bind(Prefix="")]List<Pricing> model)
{
return View("Index", new{id});
}
Upvotes: 0
Views: 1343
Reputation: 532515
Because you are really trying to retrieve a list of models (of type Pricing), you will either need to develop a custom IModelBinder and use it or iterate through the form collection and pull the data for each pricing model out of the form parameters and reconstitute them. Given your code, though, I don't see why you need to do this.
Is it really the case that you want to get the model data associated with the given id? Or is there more code than what you've shown? In the former case, the best thing to do is probably re-run the query using the id and not bother with the extra parameters to the controller action.
Upvotes: 2