2016-10-10 82 views
0

我有描述元素的XML文件,描述很长,我怎么能显示它们作为GridView中的格式文本。我尝试在描述中添加<br/>标签,但asp.net页面不显示它们。Xml格式化数据到gridview asp.net C#

我有个结构名称FileItems并且在描述字符串,所以从XML到该保存数据,

FileItems.AppDescription = xmlNode.ChildNodes[i].InnerText; 

在的.aspx侧我使用以下代码来显示:

<asp:BoundField DataField="AppDescription" HeaderText="AppDescription" 
     SortExpression="AppDescription"> 
     <ItemStyle Width="55%"></ItemStyle> 
    </asp:BoundField> 

在XML文件的样本文本,

<description> 
1. Lorem Ipsum is simply dummy text of the printing and typesetting industry. 
2. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s. 
3. When an unknown printer took a galley of type and scrambled it to make a type specimen book. 
4. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. 
</description> 

回答

0

在绑定列使用设定的HTMLEncode = “假” 解决它。也添加在xml文件中。如果有任何其他方式来解决它,那么我想知道,我想我们也可以使用httputility的htmldecode。