Add a reference to Build.Mvc.dll
From the Nuget Package Manager Console, you can type this command:
PM> Install-Package Build.Mvc5
Just add Build.Mvc.Html to your namespace imports in the web.config
<system.web.webPages.razor>
<pages>
<namespaces>
<add namespace="Build.Mvc.Html" />
</namespaces>
</pages>
</system.web.webPages.razor>
TIP: There's a web.config in the root of each of your view folders!
@Html.ActionLink("Cancel", "Index", "Home", null, new { data_icon = "arrow-l", data_rel = "back" })
@( Html.BuildActionLink("Cancel", "Index", "Home"). Data("icon", "arrow-l"). Data("rel", "back"))
View a list of Common Methods for all Build extensions or other Tips for using Build.Mvc
Build MVC can easily be extended... just add your own extensions!
/// <summary> /// This would add an Email() method which sets the type, placeholder text and tooltip /// </summary> public static TBuilder Email<TBuilder>(this TBuilder instance) where TBuilder : ITextBoxBuilder { return instance.Attr("type", "email"). Placeholder("yourname@your.com"). Tooltip("Enter your email"); }
Or in VB.NET
''' <summary> ''' This would add an Email() method which sets the type, placeholder text and tooltip ''' </summary> <Extension()> Public Function Email(Of TBuilder As ITextBoxBuilder)(instance As TBuilder) As TBuilder Return instance.Attr("type", "email"). Placeholder("yourname@your.com"). Tooltip("Enter your email") End Function