开发者

Can an MVC2 or MVC3 html.routelink contain &laquo and &raquo?

开发者 https://www.devze.com 2023-02-07 15:10 出处:网络
What\'s the syntax for displaying this? My program will always render « literally in the pagination helper I am creating, and since the switch to MVC3 there seems to be no way to even hack it wi

What's the syntax for displaying this? My program will always render « literally in the pagination helper I am creating, and since the switch to MVC3 there seems to be no way to even hack it wit开发者_如何学编程h Eval( string.FromCharCode )


Just use the corresponding UTF-8 character and the HTML helper will take care of the encoding it:

@Html.RouteLink("«", new { action = "navigate", page = 1 })
@Html.RouteLink("»", new { action = "navigate", page = 3 })


As long as you are using UTF-8 as your character-set then showing the « directly (without encoding it) is perfectly valid XHTML.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号