Reputation: 2066
I would need to post a model from a view to two different actions, not in the same controller.
I've tried with ActionLink but I lose data, being the model comples, for example one of the properties is
public IEnumerable<Lot> Lots { get; set; }
The other option I've tried is what is explained here for example
Handling 2 buttons submit Actions in a single View/Form - ASP.NET MVC 2 RTM
But I face the problem of having the actions in two different controllers.
I think I can do it with an ajax post, but I've read that is not recommended at all, so I'd love to hear any other option I can't think of.
Thanks
Upvotes: 0
Views: 76
Reputation: 124716
I would need to post a model from a view to two different actions, not in the same controller.
Probably I don't understand what you're looking for, but here's a View that posts to actions in two controllers:
@using (Html.BeginForm("Action1", "Controller1"))
{
...
<input type="submit" ... />
}
@using (Html.BeginForm("Action2", "Controller2"))
{
...
<input type="submit" ... />
}
This looks too simple to be what you want, so can you elaborate?
Upvotes: 2