Reputation: 544
I have a view called DetailsLane
and another AddItem
. When the DetailsLane
is rendered, it returns a model class with properties. The AddItem
action is inside of the same controller, but when I finish whatever I had to do inside of this action, I can't re-render the DetailsLane
to update the view.
The view is called first time: it works!
public ActionResult DetailsLane(int? id, int? IdInstance)
{
return View(get(IdInstance, id));
}
public ActionResult AddLine(FormCollection collection)
{
// I did my stuff in here, and I want to return the initial View or,
// validate something from the collection.
return DetailsLane(val, val); // doesn't work!
}
Upvotes: 0
Views: 689
Reputation: 1105
You want to use RedirectToAction
and you can pass arguments as shown here
public ActionResult AddLine(FormCollection collection)
{
// I did my stuff in here, and I want to return the initial View or,
// validate something from the collection.
return RedirectToAction("DetailsLane", new { id = val1, IdInstance = val2 });
}
note that id
and IdInstance
match the parameter names in your DetailsLane
action method.
Upvotes: 2