1

I have in a razor page the following bootstrap tab layout:

<ul class="nav nav-pills nav-justified">
<li class="active"><a href="#overview" data-toggle="tab" >overview</a></li>
<li><a href="#Profil" data-toggle="tab" >Profil</a></li>
<li><a href="#bla" data-toggle="tab" >Bla</a></li>
</ul>

<div class="tab-content">
    <div class="tab-pane fade in active" id="overview">
        <p>overview
    </div>
    <div class="tab-pane fade in active" id="Profil">
        <p>Profil
    </div>
    <div class="tab-pane fade in active" id="bla">
        <p>bla
    </div>
</div>

All working fine, except: How can i call the same page with a different tab and content active?

Obviously if i do a

return RedirectToAction("Edit", "Profil");

to the same view and controller method it takes the initial html.

What could be a solution for that?

I already thought in setting a tempdata string like so:

@TempData["activatesecondtab"] = "2ndtabactive";

and would do then in my razor page:

if(@TempData["activatesecondtab"] == "2ndtabactive")
use this html
else
use that html

...but it doesn't accept the condition like this...

SunnySonic
  • 1,318
  • 11
  • 37
  • https://stackoverflow.com/questions/46961517/how-to-keep-tab-active-after-postback-asp-net-core best way to do it!! – SunnySonic Jun 26 '18 at 21:27

1 Answers1

0

How to keep tab active after postback ASP.Net Core … best way to do it!!

SunnySonic
  • 1,318
  • 11
  • 37