+1-888-365-2779
Try Now
More in this section

Pure MVC Form

1 posts, 0 answered
  1. Ruth
    Ruth avatar
    25 posts
    Registered:
    17 May 2012
    03 Aug
    Link to this post
    Following a form post if my model is invalid how to I return the current page in order to display any errors?

    I have an issue whereby I have a template with a widget on it. I have a page based on the template on which I have a widget containing a form. My widget controller actions are as follows:

    public ActionResult Index()
    {
    return View("Index", new FormTestModel());
    }

    [HttpPost]
    public ActionResult Index(FormTestModel model)
    {
    return View("Index", model);
    }

    And my view:

    @using Telerik.Sitefinity.UI.MVC

    @model SitefinityWebApp.Mvc.Models.FormTestModel
    @using (Html.BeginFormSitefinity(true))
    {
        @Html.TextBoxFor(m => m.Name)
        <button type="submit">submit</button>
    }

    When the form is submitted the post action fires but when I return it shows the original page but without the widget which is on the template.
1 posts, 0 answered