开发者

MVC, change the style of action link

开发者 https://www.devze.com 2023-01-12 02:13 出处:网络
I have an action link like this: <%=Html.ActionLin开发者_开发问答k(Name + \" (\" + Count+ \")\", \"ActonName\", \"Controller\", new { ID= itemID}, null)%>

I have an action link like this:

<%=Html.ActionLin开发者_开发问答k(Name + " (" + Count+ ")", "ActonName", "Controller", new { ID= itemID}, null)%>

it shows

football (5)

I want it displays like this:

football (5)

I have try to change the actionlink like this:

<%=Html.ActionLink(Name + " <b>(" + Count+ ")</b>", "ActonName", "Controller", new { ID= itemID}, null)%>

it does not work. any idea to to this?

Many thanks.


ActionLink always encodes the text. You could use Url.Action:

<a href="<%= Url.Action("ActonName", "Controller", new { ID = itemID }) %>">
    <b>(<%= Count %>)</b>
</a>

or write a custom HTML helper if you don't like the tag soup.

0

精彩评论

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