2016-10-10 136 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。