I’m trying to call a action method from different controller but it´s not working. It simply skips the RedirectToAction
here's my code:
public ActionResult sendPolicy(TempPoliciesUpload TempPolicy)
{
return RedirectToAction("Insert", "Policies", new { tempPolicy = TempPolicy });
}
Please help.
If you need to send a complex object you can try just returning the view from another controller like this:
public ActionResult sendPolicy(TempPoliciesUpload TempPolicy) { return View("~Views/Policies/Insert.cshtml", TempPolicy ); }
If you want this view to post back to the correct controller method you will need to specify this in the 'BeginForm' Html Helper:
... @using(Html.BeginForm("Insert", "Policy") { ... }
This really isn't best practice, but it is a workaround that you can use until you fix enough of the rest of your app so that you can use the redirects properly.