讀取生成的xml

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>無標題頁</title>
</head>
<body>
    <form id="form1" runat="server">
    <div><table>
        <asp:GridView ID="GridView1" runat="server" DataSourceID="XmlDataSource1" AutoGenerateColumns="False">
            <Columns>
                <asp:TemplateField HeaderText="Column">
                    <ItemTemplate>
                        <tr><td><a href=<%#XPath("link")%>><%#XPath("title")%></a></td></tr>
                    </ItemTemplate>
                    <AlternatingItemTemplate>
                       <tr><td><a href=<%#XPath("link")%>><%#XPath("title")%></a></td></tr>
                    </AlternatingItemTemplate>
                </asp:TemplateField>
            </Columns>
        
        </asp:GridView>
        &nbsp;
        <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="http://www.***.com/news.xml"
            XPath="/document/item"></asp:XmlDataSource>
            </table>
   
    </div>
    </form>
</body>
</html>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章