how do you add a NEW LINE character in the string portion of an ActionLink?

I'm building a Ajax.ActionLink in C# which starts:

<%= Ajax.ActionLink("f lastname", ...more stuff

and I'd like there to be a new line character between the words "f" and "lastname". How can I accomplish this? I thought the special character was n but that doesn't work, and <br> doesn't work either.


You might have to revert to doing something like:

<a href="<%= Url.Action("action") %>">f<br />last</a>

And then wire in the Ajax bits manually.


尝试这个:

<%= Ajax.ActionLink("f<br />lastname", ...more stuff

You can't use <br /> because the ActionLink method (and indeed I believe all the html and ajax extension methods) encode the string. Thus, the output would be something like

<a href="...">f&lt;br /&gt;lastname</a>

What you could try instead would be a formatting:

<%= string.Format(Ajax.ActionLink("f{0}lastname", ...more stuff), "<br />") %>
链接地址: http://www.djcxy.com/p/42890.html

上一篇: Mono上的PdfSharp

下一篇: 如何在ActionLink的字符串部分添加NEW LINE字符?