Here's a piece of my HTML code
<div id = "mydiv">
<% = Html.ActionLink("Some Text","SomeAction")%>
</div>
I'd like to style it in white so that it doesn't conflict with the background, which is also blue. So I did this:
#mydiv {background-color:blue;}
#mydiv a:link { color:white}
But, it doesn't work -- the color it's still blue. How can I do it? Maybe, I just did not write well the selectors.
Thanks for helping.
@Html. ActionLink("name", "Action", "Controler", new { id= sentId, Style = "color:White" }, null);
Yes, there is a difference. Html. ActionLink generates an <a href=".."></a> tag whereas Url. Action returns only an url.
ActionLink(HtmlHelper, String, String, String, String, String, String, Object, Object) Returns an anchor element (a element) for the specified link text, action, controller, protocol, host name, URL fragment, route values, and HTML attributes.
ActionLink is rendered as an HTML Anchor Tag (HyperLink) and hence it produces a GET request to the Controller's Action method which cannot be used to send Model data (object). Hence in order to pass (send) Model data (object) from View to Controller using @Html.
#mydiv a { color:white; }
Maybe
<%=Html.ActionLink("Text","Act","Ctrl",new {@style="color:white;"}) %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With