Styling ActionLinks in _LoginPartial compared to _Layout

525 views Asked by At

Parent question: ASP.net MVC navbar-brand to header text color

I have successfuly changed the styling of ActionLinks in my _Layout file. They successfuly inherit style from my Style.css file is this way:

<li>@Html.ActionLink("About", "About", "Home", new { area = "" }, new { @class = "navbar-brand" })</li>

When I try to do the same to the ActionLinks in the _LoginPartial file:

<li>@Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" }, new { area = "" }, new { @class = "navbar-brand" })</li>

The references added to the _LoginPartial ActionLink are these:

new { area = "" }, new { @class = "navbar-brand" }

This does not at all work, but breaks the application. These links are stardard MVC and not changed.

How do I apply styling to the _LoginPartial ActionLinks?

2

There are 2 answers

0
Marian Ban On BEST ANSWER

you should write:

@Html.ActionLink("Register", "Register", "Account", new { area = "" }, new { id = "registerLink", @class = "navbar-brand" })
0
wut On

Sub-question: How would I apply the navbar-brand style to a BeginForm ?

Html.BeginForm("Logoff", "Account", new { area = ""}, FormMethod.Post, new { id = "logoutForm", @class = "navbar-brand" })

This is not accepting the style fully. The font is applied, but unfortunatly, the color, is not. Is this perhaps because of an error in the area reference?