Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/khalidabuhakmeh/whatroute

A set of ASP.Net MVC extension methods to help you figure out whether you are on a particular route or not.
https://github.com/khalidabuhakmeh/whatroute

asp-net c-sharp mvc

Last synced: 19 days ago
JSON representation

A set of ASP.Net MVC extension methods to help you figure out whether you are on a particular route or not.

Awesome Lists containing this project

README

        

h1. WhatRoute for ASP.Net MVC

A simple set of extension methods to help you figure out whether you are on a particular route or not. Also a nice helper method to generate routes based on a name of a route. You still need to provide route values that are not set in the defaults.

Available via "NuGet":http://nuget.org/packages/WhatRoute

 PM> Install-Package WhatRoute 

h2. Getting Started

1. Install the package using NuGet.
2. Add the WhatRoute.Core namespace to your views web.config
3. Start accessing the extension methods

h2. What's available?

You have the following methods availble:

Url.PathTo(string routeName, object routeValues = null)

Url.IsActive(string action, string controller, string area = "")
Url.IsActive(object routeValues = null, object querystringValues = null)
Url.IsActiveRoute(string routeName, object routeValues = null, object querystringVaules = null)

Html.IsActiveCss(object routeValues = null, object querystringValues = null, string cssClass = "active")
Html.IsActiveCss(string action, string controller, string area = "", string cssClass = "active")
Html.IsActiveRouteCss(string routeName, object routeValues = null, object querystringValues = null)

h2. Example Code (from sample)





h2. Note on Patches/Pull Requests

* Fork the project.
* Make your feature addition or bug fix.
* Add tests for it. This is important so I don't break it in a
future version unintentionally.
* Send me a pull request. Bonus points for topic branches.

h2. Contributors

Written by "Khalid Abuhakmeh":http://github.com/khalidabuhakmeh

h2. Latest Release

* 1.1.0 : added PathTo and IsActiveRoute / IsActiveRouteCss
* 1.0.0 : initial release