Add styling to all @Html.ActionLink from css class -
I know that I am using a class to add an HTML link, which single Functional at one time: is there a way to define a class (Add a style to all divs in a very CSS file like: I can just write There will be automatically without having to go to each action link and define the class for the nonlinear link One way to do this: To add style for all button instances: What I could do with something like: and therefore all can be written as aplication: @html. Exynalink ("Action", "Controller") And automatically include the style given in my CSS file? I do not do it the first way to do, but I've already defined as ~ 100 made, no class, and copy and paste: Akshnlink just generate common anchor, then You can type: But just to get ActionLinks you will need to call them through a square or container. Also take a better way to custom Aekshnlink inside a default class to it and using this class you can make your selection, as you will use this new custom Akshnlink and paste Class No need to copy code has been copied
@ html.ActionLink ("add", "updatenot", "notes", new {id = 0, type = (int ), The "{@ class =" BTN BTN-primary icon-edit "}, empty)
However,
div {color: red;}; ^ ^ | | This will work on * all * divs < color: red included
@ class = "myClass" / Code>
for example
input [type = "button"] {background color: red; }
input [type = "actionlink"] {// Akshnlink all projects Style}}
class = "myClass"
a {color: red; }
public static class Linkakstenshn {public static MvcHtmlString MyActionLink (this HtmlHelper html helper, string link text string action, string controller) {var currentAction = htmlHelper.ViewContext.RouteData.GetRequiredString ( "Action" ); Var current controller = htmlHelper.ViewContext.RouteData.GetRequiredString ("controller"); If (Action == Current Actions & Controllers == Current Controller) {var anchor = new TagBuilder ("a"); Anchor. Attribute ["href"] = "#"; Anchor.AddCssClass ("currentPageCSS"); Anchor.SetInnerText (LinkText); Return MvcHtmlString.Create (anchor.ToString ()); } Return htmlHelper.ActionLink (linkText, Action, Controller); }}% = HTML.MyActionLink ("Hello Foo", "Index", "Home")%> & Lt;% = HTML.MyActionLink ("Hello Bar", "About", "Home")%>
Comments
Post a Comment