Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using (Ajax.BeginForm("MyAction", "MyController", null, new AjaxOptions
- {
- InsertionMode = InsertionMode.Replace,
- UpdateTargetId = "content",
- LoadingElementId = "loading"
- }))
- {
- @Html.ValidationSummary()
- <div id="content">
- @Html.EditorFor(m => m.Panes, "EditorTemplates/PanesViewModel")
- </div>
- }
- <fieldset>
- <div id="wrapper">
- <table>
- @Html.EditorFor(m => m.List, "EditorTemplates/ListViewModel")
- </table>
- </div>
- <button type="submit">Submit</button>
- </fieldset>
- @Html.EditorFor(m => m.Items, "EditorTemplates/ItemViewModel")
- <tr>
- <td>@Html.EditorFor(m => m.FieldName)</td>
- </tr>
- [HttpPost]
- public ActionResult MyAction(PanesViewModel model)
- {
- if (ModelState.IsValid)
- {
- // Do stuff
- return PartialView("EditorTemplates/PanesViewModel");
- }
- // Should retain model state and display Validation Summary.
- return PartialView("EditorTemplates/PanesViewModel", model);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement