MvcExtensions Methods

Represents a series of extensions used to interact with Mvc Web App Razor Views.

Definition

Namespace: Tipi.Tools.UIExtensions.Mvc

Assembly: Tipi.Tools.UIExtensions.Mvc.dll

Package: Tipi.Tools.UIExtensions.Mvc

This class is static and has various methods to render logic directly on your html.

This method takes three parameters representing the Controller Name, Action Name and Class Name. The function of this method is to check your the provided Controller and Action and if it matches your current page, it renders the Class name provided.

ActiveClass(String?,String?,String)

This method takes three parameters representing the Controller Name, Action Name and Class Name. The function of this method is to check your the provided Controller and Action and if it matches your current page, it renders the Class name provided.

It takes 3 parameters in the following order: Name of the controller, Name of the action and name of your active class. If nothing is provided the defaults are Home , Index , active, this means that Default behaviour is the Home controller with Index action and a class called active.

Copied!

                    
    // Usage inside a Razor View, When the Action parameter is not provided "Index is used as default.
    @Html.ActiveClass("Home")

    // Usage inside a Razor View, If the second parameter is provided you can specify an Action.
    @Html.ActiveClass("Home", "Privacy")

    /* Usage inside a Razor View, If the third parameter is provided you can specify a class 
       if nothing is provided the default class is "active".
    @Html.ActiveClass("Home", "Privacy", "focus")

    // You can pass multiple controllers and actions at once separated by commas.
    @Html.ActiveClass("Home,About,Portal", "Index,Privacy,Footer")