Showing posts from 2018

ASP.Net MVC : ActionLink with bootstrap icon

How many times you wanted to add an icon to your action link?!. using Html.ActionLink method is not possible to add icon as it renders the link with just HtmlAttribute you provide. ex : @Html.ActionLink("My Link","actionName","controllerName",new {id = Model.Id}, new {style="margin:10px", @class="btn btn-info"}); this will be rendered as shown in   if I want to add icon using bootstrap css classes, I can not use HtmlHelper methods and have to use plain html tags like this <a href="url-here" class="btn btn-info" style="margin:10px;">         <i class="glyphicon glyphicon-pencil"></i>         <span>My Link</span>     </a> this will be rendered  as so to simplify my .cshtml file and make it easy for developers to add icon to their action links, I have created an extension method IconActionLink that will replace the previous html sinppe