John Paul Cirilos
John Paul Cirilos

Reputation: 137

MVC working with CSHTML href

I have this cshtml partial layout view in my system

<div class="row" style="background: #816BFA; margin-left: 0; margin-right: 0; margin-top: 30px; height: 7%">
    <h class="col-sm-4" style="text-align: center; font-size: 18px; color: black; height: 40px; top: 8px"><i class="glyphicon glyphicon-home"></i>@Html.ActionLink("Truck List","TruckList")// this</h>
    <a href="index.html" class="col-sm-4" style="text-align: center; font-size: 18px; color: black; height: 40px; top: 8px"><i class="glyphicon glyphicon-book"></i> Reports</a>
    <a href="index.html" class="col-sm-4" style="text-align: center; font-size: 18px; color: black; height: 40px; top: 8px"><i class="glyphicon glyphicon-user"></i> User Accounts</a>
</div>

The output is this

enter image description here

You might not see the text "Truck List" Because in html.action link if you click, it always turns blue. Is there a solution to turn it black like the other text in the menu? And this link redirects to Action "Trucklist" Controller "Trucks"

Upvotes: 1

Views: 677

Answers (2)

diamondhna
diamondhna

Reputation: 32

Just add this CSS class:

h a {
        color: black;
    }

Upvotes: 0

Awn Ali
Awn Ali

Reputation: 1379

Replace your below code:

@Html.ActionLink("Truck List","TruckList")

With this:

Html.ActionLink(
"Truck List",
"Create",
CONTROLLERNAME,
null,
new { @style= "color: black;" }
)

Upvotes: 3

Related Questions