2
votes

I am new to Sitecore MVC and examples are lacking. I have view that when on postback only the views returns without the layout.

I tried to followed this

Sitecore MVC Controller and Forms - ActionResult not rendering Layout on postback

but the sample is already gone.

here's my view

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

          <div class="row">
            <div class="col-md-12 text-center">

            <div class="col-md-4">
                <strong>Hospital</strong>
                Name:<br/>
                @Html.TextBoxFor(m => m.HospitalName, "", new { @class = "form-control", @placeholder = "", style = "width:300px" })
            </div>
                <br/>
                <input type="submit" value="Submit">

            </div>
        </div>
    }
    }

The rendering works, as well as the function and validation. It's just that on postback the whole layout is gone.

tried

partialview method

return to base.index()

I already inherit sitecorecontroller

1
The temporary solution I did for now is I used the index action process the submission. Although I wanted to call a different action to do this process so now my formhandler is just empty @html.sitecore().formhandler() I still hope Sitecore MVP can help me with this. @MichaelEdwards If you still have your sample can you please post it again.. I checked your website..it's empty..CyberNinja

1 Answers

0
votes

You can use

Response.Redirect(LinkManager.GetItemUrl(your item), false);

to post back whatever you want