Priyanka Singh

Priyanka Singh

  • 693
  • 1.4k
  • 671.1k

How to call active class dynamically in asp.net core

May 1 2021 8:39 AM
<li class="nav-item">
<a class="nav-link mmenu active" aria-current="page" href="@Url.Index("Home")">Home</a>
</li>
<li class="nav-item">
<a class="nav-link mmenu " aria-current="page" href="@Url.Index("Home1")">Home1</a>
</li>
<li class="nav-item">
<a class="nav-link mmenu " aria-current="page" href="@Url.Index("Home2")">Home2</a>
</li>
 
I need to call active class dynamically whenever I visit the navigation tab. That particular class in li should be active. 

Answers (2)