Have you ever needed to detect what part of the application is currently being viewed? This might be a bigger issue if you write a lot of shared/partial views or custom display or editor templates. Another scenario, which is the one I encountered when I first started down this path, is when you have some type of menu and you’d like to be able to determine which item represents the current page so you can highlight it in some way. A simple example is the menu that is created as part of the default ASP.NET MVC 2 Application template.

<div id="menucontainer">

<ul id="menu">

<li><%= Html.ActionLink("Home","Index","Home") %></li>

<li><%= Html.ActionLink("About","About","Home") %></li>

</ul>

</div>

The part that got me at first, however, was the following entry in the default style sheet (Site.css):

ul#menu li.selected a

{

background-color:#fff;

color:#000;

}

I assumed that the .selected class would automatically get applied to the active menu item. After trying a few different things, including the MvcContrib MenuBuilder, I decided to write my own extension methods so I would have more control over the output. First, I needed a way to determine what view the user has navigated to based on the requested URL and route configuration. Now, I am sure there are many ways to do this, but this is what I came up with:

The blog are the main media of knowing about the world that what is going on in this world and what is gonna be. this is one of the best that kind of blog which has lot of those information which everyone like to have. I personally like to thank to this blog.

One thing to mention about the IsCurrent function, when you don't pass any parameters you'll get an empty string[]. In your function you do a actionNames == null check this will only be true if you pass a null into the params parameter. You could do a check for actionNames.Any()