HtmlEncode text in DetailsView in ASP.NET
I开发者_运维百科 have taken over a project where HtmlDecode has been run on all data in the database. I will now use the asp:DetailsView to edit the data. The problem is that the asp:BoundField does not encode the data so that it appears correctly in edit mode. How do I solve that?
You should be able to set the HtmlEncode property on the asp:Boundfield to true. When this property is set to true, the data will be encoded before it appears.
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.boundfield.htmlencode.aspx
精彩评论