Solved

Active Bootstrap Items Not Highlighted

Posted on 2013-06-26
2
403 Views
Last Modified: 2013-08-22
Hi:

I've set up a Bootstrap Menu with the following code:

<div class="navbar navbar-inverse">
                <div class="navbar-inner">
                    <ul class="nav">
                        <li class="active"><a href="/Home/Index"><i class="icon-home icon-white"></i>Home</a></li>
                        <li>@Html.ActionLink("Home", "Index", "Home")</li>
                        @if (Request.IsAuthenticated)
                        {
                            <li>@Html.ActionLink("My Courses", "MyCourses", "Home")</li>
                        }
                        <li>@Html.ActionLink("FAQs", "Faqs", "Home")</li>
                    </ul>

                </div>
            </div>

Open in new window


What I'd like to do is that when a person presses on a selection other than home, that item is highlighted and home is not.

Any help in how to do this greatly appreciated.

RBS
0
Comment
Question by:RBS
2 Comments
 
LVL 11

Accepted Solution

by:
lenordiste earned 500 total points
ID: 39279649
hi,

you just need to add the "active" class whenever you want the nav link to be the active one. The only trick is to figure out how to do this dynamically. You can do so in javascript or by using code behind. I thought this solution seemed decent to do just that :-)
http://chrisondotnet.com/2012/08/setting-active-link-twitter-bootstrap-navbar-aspnet-mvc/
0
 

Author Comment

by:RBS
ID: 39279970
Worked like a charm!

Thanks,
RBS
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now