Solved

Active Bootstrap Items Not Highlighted

Posted on 2013-06-26
2
407 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

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

821 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