表列中的Xml数据,然后如何显示Gridview。 [英] Xml Data In Table Column , Then How Can I Show It Gridview.
问题描述
我的表中有一个数据,它们是列中的XML数据。就像这样。
I have a Data in my Table in which their is XML data present in the Column. Just like this.
TableName OldContent
ARCaseStatusMaster <row ARCaseStatusID="2" CaseStatusName="Closed" StatusFlag="Active" CreatedUserID="11" CreatedTime="2014-04-14T13:06:46.227" UpdatedUserID="11" UpdatedTime="2014-05-15T16:23:19.790" IsDeleted="0" LockVersion="6" />
TaskCategoryMaster <row TaskCategoryID="5" CategoryDescription="AR" CompletionStatus="Y" CreatedUserID="7" CreatedTime="2013-09-06T15:11:29.187" UpdatedUserID="11" UpdatedTime="2014-05-20T12:58:09.307" LockVersion="4" /> />
所以桌面名称,旧内容是列和'arcasestatusmaster'& 'Taskcategorymaster'是表格,< row ....>这是开始是存储在列名称Old COntent中的XML数据。
所以请告诉我如何从coloumn获取此数据并将其显示在gridview. \
plz suggeset me或告诉我另一个想法是保存数据而不是XML格式。,
so THe TABLE NAME , Old content are the columns and 'arcasestatusmaster'&'Taskcategorymaster' are the Table and the <row....> this is start is the XML data which is store in the Column name Old COntent.
so tell me how can i take this data from the coloumn and show it into the gridview.\
plz suggeset me or tell me the another idea to save the data instead of XML aformat.,
推荐答案
将数据读入DataSet或DataTable并将其绑定到gridview,在模板字段中使用HttpUtility.HtmlDecode
,如下所示
read the data in to DataSet or DataTable and bind it to gridview, useHttpUtility.HtmlDecode
like below in your template field
<asp:templatefield headertext="OldContent" xmlns:asp="#unknown">
<itemtemplate>
<%# HttpUtility.HtmlDecode(Eval("OldContent").ToString()) %>
</itemtemplate>
</asp:templatefield>
这篇关于表列中的Xml数据,然后如何显示Gridview。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!