Skip to main content
 首页 » 编程设计

c#之如何使用分隔 rune 本符号 () 而不会在我的网页上出现 HTML 错误

2024年02月20日11haluo1

对于我网页上的分页功能,我将使用符号 < 作为分隔符。当我运行 html 检查时,它给我这个错误:

Line 747, Column 318: character "<" is the first character of a delimiter but occurred as data  
…quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, true))"><<   </a> 

我知道一定有办法解决这个问题。这是我的 aspx 代码的样子:

 <td> 
     <asp:LinkButton ID="PagerPrev" runat="server" CommandName="Page" CommandArgument="Prev" 
    Text="<&nbsp;&nbsp;&nbsp;" ToolTip="Previous" /> 
</td> 

如果您在 Text="之后看到,我使用了 <,这就是 html 错误检查器正在拾取的内容。 感谢您的帮助。

请您参考如下方法:

您必须像使用不间断空格一样对其进行编码:

"<"是"&lt;"

">"将是 "&gt;"