2
votes

i'm using Sitecore 7 with MVC enabled. I have a cshtml layout that has a header, menu, footer and placeholder in it.

When i submit a form in the page with POST method, it gets to the controller and the controller is returning a viewresult for some reason only that particular html from the viewresult gets rendered to the page. Meaning that after doing a postback the header, menu, footer is gone and only the html from the result gets rendered on the page.

Is this behaviour expected or am i doing something wrong? i would expect that when i do form postback it would return the viewresult with the layout rendered as well

1

1 Answers

2
votes

i was supposed to use Html.BeginRouteForm instead of Html.BeginForm

adding this line fix the problem

   @using (Html.BeginRouteForm(Sitecore.Mvc.Configuration.MvcSettings.SitecoreRouteName, FormMethod.Post))
   {
      @Html.Sitecore().FormHandler()
   }