MVC3 - How to Save the Postback Index Tab
I am new to MVC. I have a jQuery tabbed view (as shown below).
<div class="demo">
<div id="demoTabs">
<ul aria-labelledby="demoTabsLabel">
<li><a href="#basicInfo">Basic Information</a> </li>
<li><a href="#address">Address</a> </li>
<li><a href="#tabbs">Tab 3</a> </li>
</ul>
<div id="basicInfo">
@using (Html.BeginForm("Create", "Organisation", FormMethod.Post)) {
<div class="editor-label">
@Html.LabelFor(model => @Model.Name)
</div>
<div class="editor-field">
@Html.EditorFor(model => @Model.Name) @Html.ValidationMessageFor(model => @Model.Name)
</div>
<div>
<a class="nexttab" href="#address">
<input id="Submit2" type="submit" value="Continue" /></a>
</div>
}
</div>
<div id="address">
@Html.Label("Address") <a class="nexttab" href="#tabbs">
<input id="Submit4" type="submit" value="Continue" /></a>
</div>
<div id="tabbs">
@Html.Label("optional") </fieldset>
<input id="Submit5" type="submit" value="Submit" />
</div>
</div>
When the user clicks the button of the "Continue" button, the transition to the next tab is carried out using the script below.
$("#demoTabs").tabs();
$(".nexttab").click(function () {
$("#demoTabs").tabs("select", this.hash);
});
But when the request returns from the controller after saving the information, it reloads the page and again moves the control to the first tab.
Could you suggest me the right way?
Many thanks
controller
[HttpPost]
public ActionResult Create(Xrm.Account account)
{
//create
org = orgModel.CreateOrUpdateOrg(account);
return Redirect(Url.Action("Create", "Organisation") + "#tabbs");
}
+3
2 answers