0

I am currently working on an asp.net 4 mvc application and I'm trying to work out the best way to redirect / refresh the parent page after a form is submitted in the child controller.

So in my main view I have

Main View

@Html.RenderAction("child")

Child View / Controller

[HttpPost]
public ActionResult Create() {    
    if (ModelState.IsValid) {
        // Save 
        Save();

        Response.Redirect(Request.Url.ToString()); <--- Redirects the main page hack
    }

    return PartialView();    
}

What is the correct way to redirect / refresh the main page hosting the renderaction?

DotnetShadow

rene
  • 41,474
  • 78
  • 114
  • 152
DotnetShadow
  • 748
  • 1
  • 10
  • 28

1 Answers1

0

just check how the default Account controller (Internet Application template) has this set for the Login/LogOff actions :

    public ActionResult LogOff()
    {
        (...)

        return RedirectToAction("Index", "Home");
    }
Paweł Staniec
  • 3,151
  • 3
  • 29
  • 41
  • Thanks for the direction, I did notice that in this case it's a partial view @Html.Partial("_LoginPartial") as opposed to @Html.Renderaction("_LoginPartial") so I think it may not work – DotnetShadow Mar 28 '13 at 23:12