Home > Blockchain >  ASP.NET MVC - Applying Html.ActionLink to an existing href
ASP.NET MVC - Applying Html.ActionLink to an existing href

Time:12-28

Basically, I'm just trying to change the href attribute to be the result of the ActionLink:

@Html.ActionLink("Home", "Index", "Dashboard", new { }, new { @class = "nav-link active" })
<a  href="index.html">
    <div ><i ></i></div>
Home
</a>

If I replaced the index.html with @Html.ActionLink("Home", "Index", "Dashboard"), then what happens is the HTML is not formed correctly.

Any suggestions would be appreciated.

Thanks!

CodePudding user response:

@Url.Action("Index", "Dashboard"), sorry this can be closed. Of course as soon as I ask I find the answer.

CodePudding user response:

I guess that this code will work as you want it to. You don't have to use @Html.ActionLink

<a  href="Dashboard/Index">
    <div ><i ></i></div>
Home
</a>
  • Related