簡體   English   中英

XML格式的數據到GridView ASP.NET C#

[英]Xml formatted data to gridview asp.net C#

我有帶有description元素的xml文件,描述很長,如何在gridview中將它們顯示為帶格式的文本。 我嘗試在說明中添加<br/>標記,但asp.net頁未顯示它們。

我有一個結構名稱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>

通過在BoundField中設置HtmlEncode =“ false”解決了該問題。 還添加在xml文件中。 如果還有其他解決方法,那么我想知道,我認為我們也可以使用httputility的htmldecode。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM