Created
May 13, 2015 22:11
-
-
Save Dillie-O/d6f2db0653d265a7bc0f to your computer and use it in GitHub Desktop.
Sitefinity Navigation Active Class Helper Method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <%@ Control Language="C#" %> | |
| <script type="text/C#" runat="server"> | |
| public static class NavHelper | |
| { | |
| /// <summary> | |
| /// Returns the active class parameter if the current url contains the | |
| /// path check specified. | |
| /// </summary> | |
| /// <param name="pathCheck"> | |
| /// The path slug to test against in the Url. | |
| /// </param> | |
| /// <returns> | |
| /// "Active" value if path matches. Empty string if not. | |
| /// </returns> | |
| public static string CheckActive(string pathCheck) | |
| { | |
| if(HttpContext.Current.Request.Url.AbsolutePath.Contains(pathCheck)) | |
| { | |
| return "active"; | |
| } | |
| else | |
| { | |
| return ""; | |
| } | |
| } | |
| } | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment