标签中的内容未正确显示 [英] content in label not shown properly
本文介绍了标签中的内容未正确显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在页面中有一个这样的标签.
当您运行该页面时,标签显示为测试",之后的所有内容均不会显示.请帮我解决.
I have a label like this in a page.
when you run the page the label is displayed as Test and every thing after that is not displayed. Please help me with a solution.
<body>
<form id="form1" runat="server">
<div>
<asp:label id="Label1" runat="server" text="Test"></asp:label>
</div>
</form>
</body>
实际上,发布问题本身就是这里的问题.
[edit]编辑以提高可读性[/edit]
Actually posting a question itself is a issue here.
[edit] edited for more readability [/edit]
推荐答案
您可能必须在字符串内的<>
括号内进行转义.
You may have to escape the <>
brackets inside the string.
您还必须使用html编码,就像在此站点上所做的一样.
该值应为"Test& ltlaClaim& gt;"
否则,它将翻译为不存在的html元素,因此将其丢弃.
祝你好运!
you must use html encodings like is done on this site as well.
The value should then be "Test <Claim>"
Otherwise it is translated as non existent html element and therefore discarded.
Good luck!
在后面的代码中使用此
字符串s ="test< test2>";
Label1.Text = Server.HtmlEncode(s);
In the code Behind use this
string s = "test <test2>";
Label1.Text = Server.HtmlEncode(s);
这篇关于标签中的内容未正确显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文