I am using MVC4, C# and visual studio ultimate 2013 in a project.
I am redirecting a user to an index page after submiting a form. However, this webpage has 2 tabs, and I want to redirect the user to the second tab, instead of the first one.
I have a Controller called Material
, with an Index
action, which sends the user to the Index
View.
public ActionResult Index()
{
return View();
}
This View is made of two partial Views, _Materials
and _Packages
.
@{
ViewBag.Title = "Index";
}
<div class="tabbable">
<ul class="nav nav-tabs">
<li class="active"><a href="#Materials" data-toggle="tab">Materials</a></li>
<li><a href="#Packages" data-toggle="tab">Packages</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="Materials">
@Html.Action("Materials", "Material")
</div>
<div class="tab-pane" id="Packages">
@Html.Action("Packages", "Package")
</div>
</div>
</div>
After performing a serie of actions in another section of the application, I which to redirect the user to the /Material
page, to the second tab, but I have no idea how to do it !
Currently I am using this code, which always redirects to the first tab:
return RedirectToAction("Index", "Material");
How can I fix my problem?