ASP MVC3 insert html tag inside actionlink

后端 未结 2 1397
一向
一向 2021-01-02 13:26

I\'m new to the ASP MVC3 and I\'m using Razor Engine.

My broplem is that I\'ve build my main navigation in form

2条回答
  •  独厮守ぢ
    2021-01-02 14:30

    Replace this:

    Link
    

    With

    @Html.ActionLink("Link", "Action", "Controller")
    

    That may auto encode the , so you can try:

    @Html.ActionLink(new MvcHtmlString("Link").ToHtmlString(), "Action", "Controller")
    

    Even more simply put, you can use @Url.Action("Action", "Controller"), in the link like:

    Link
    

提交回复
热议问题