问题
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:
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()
}
来源:https://stackoverflow.com/questions/17287910/sitecore-mvc-form-postback-does-not-return-a-full-layout