Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/khalidabuhakmeh/whatroute
- Owner: khalidabuhakmeh
- License: mit
- Created: 2013-01-03T21:05:03.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2013-01-04T20:19:15.000Z (about 12 years ago)
- Last Synced: 2025-01-12T09:13:25.352Z (26 days ago)
- Topics: asp-net, c-sharp, mvc
- Language: JavaScript
- Size: 461 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.textile
- License: MIT-LICENSE.txt
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 methodsh2. 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)
Root
Default Page Home#Index
Show Page with id Show#Index id of 1
Show Page with id Show#Index id of 2
Show Page with querystring of "guess"
Index in an area TestArea#Index
A really gross path
@if (Url.IsActive(new {action = "gross", controller = "home", a = 1, really = 2, gross = 3, path = 4})) { @Html.Partial("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