Active tab after click.6yAsked Dec 16, 2020, 1:52 AM ESTSolvedShareLinkedInXCopy linkSaveHow to active a tab after click in mvc viiew(layout page).
Active tab after click.6yAsked Dec 16, 2020, 1:52 AM ESTSolvedShareLinkedInXCopy linkSaveHow to active a tab after click in mvc viiew(layout page).
Sachin SinghRank #66 · 26.2K reputation6y agoPosted Dec 16, 2020, 1:56 AM EST✓ Accepted answer0use css and Jquery $('.achor').on('click', function() { $('li').removeClass('active'); $(this).closest('li').addClass('active'); }); .active { color: red; background-color: black; } 0
Mageshwaran RRank #411 · 6.1K reputation6y agoPosted Dec 16, 2020, 2:06 AM EST0Try this code,Razor Page: "hidden" value="@TempData["Selected"]" id="hfSelected" /> "hidden" value="@TempData["Enabled"]" id="hfEnabled" /> "hidden" value="@TempData["Disabled"]" id="hfDisabled" /> "tabs"> "nav nav-pills"> "active">"#tabs-1" data-toggle="tab">Details "#tabs-2" data-toggle="tab">Material "tab-pane active" id="tabs-1"> Hello "btnSaveMaterial" type="submit" value="Next" class="btn btn-primary" /> "tab-pane" id="tabs-2"> @using (Html.BeginForm("AddMaterial", "Home", FormMethod.Post)) { //////form section details } Controller: [HttpPost] public ActionResult AddMaterial(ItemModel model, string id) { TempData["Selected"] = "2"; TempData["Enabled"] = "0,1,2"; id = Convert.ToString(TempData["NewID"]); ViewBag.ActiveTab = id; ////insert data into database part return new RedirectResult(Url.Action("FormRequest", new { id }) + "#tabs-2"); } 0Join to answer this questionEvery answer you publish earns 20 SHARP.Create free accountSign inKnow the answer?Answer a question in the forums and earn +20 SHARP for every answer.See unanswered questionsForumsTop experts01Arun PottiAnswers in the forums20answers02Tahir AnsariAnswers in the forums5answers03Kamlesh KumarAnswers in the forums5answers04Sam HobbsAnswers in the forums4answers05Željko PerićAnswers in the forums3answers?YouYour name goes here.Every answer: 20 SHARP.JoinFull leaderboard →2026DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sachin SinghRank #66 · 26.2K reputationPosted Dec 16, 2020, 1:56 AM EST
Mageshwaran RRank #411 · 6.1K reputationPosted Dec 16, 2020, 2:06 AM EST
"nav nav-pills"
>Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts