Home > Mobile >  How to turn HTML link into ASP.NET MVC action link with attributes
How to turn HTML link into ASP.NET MVC action link with attributes

Time:01-31

I try to convert this HTML link

Projects

into MVC code, but I don't know how to add the href and the aria-expanded attributes

@Html.ActionLink("Project", "ProjectDetails", "Project", new { @class = "has-arrow" })

Can anyone help please?

CodePudding user response:

You can do the following to your ActionLink:

@Html.ActionLink("Projects", "ProjectDetails", "Project", new {href="javascript:void(0)", @class = "has-arrow", @aria-expanded="false"})

This will convert to your a tag in the question

CodePudding user response:

its works like that

                @Html.ActionLink("Projects", "ProjectDetails", "Project", new { href = "javascript:void(0)", @class = "has-arrow", @ariaexpanded = "false" })
  •  Tags:  
  • Related