在asp.net W3C验证错误 [英] w3c validation error in asp.net
本文介绍了在asp.net W3C验证错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在W3C验证新的,我想解决这个错误,但它没有发生。该错误是如下:
I am new in W3c validations, I am trying to fix this error but it's not happening. The error is following:
字符&放大器;是一个分隔符的第一个字符,但发生的数据。
character "&" is the first character of a delimiter but occurred as data.
我使用DataList控件绑定数据,这里是哪里发生了W3C验证错误就行了。
I am using DataList Control to bind data and here is the line where the w3c validation error occurs.
<asp:Label ID="lblDescription"
runat="server"
Text='<%#Eval("Decr") %>'>
</asp:Label>
在数据库中, DECR
存储和这个(安培)的特殊字符也是在描述字段中给出。 W3C 是没有验证这一行。
In database, the Decr
is stored and this(&) special character is also given in the description field. w3c is not validating this line.
推荐答案
下面是我想出了解决办法:
Here is the solution I came up with:
<asp:Label ID="lblDescription" runat="server" Text='<%# Server.HtmlEncode( (string) Eval("Decr")) %>'></asp:Label>
这篇关于在asp.net W3C验证错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文