惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
The Register - Security
The Register - Security
Hugging Face - Blog
Hugging Face - Blog
博客园 - 聂微东
GbyAI
GbyAI
Recent Commits to openclaw:main
Recent Commits to openclaw:main
博客园_首页
D
Docker
S
Security @ Cisco Blogs
K
Kaspersky official blog
爱范儿
爱范儿
Simon Willison's Weblog
Simon Willison's Weblog
TaoSecurity Blog
TaoSecurity Blog
V
V2EX
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Troy Hunt's Blog
Cloudbric
Cloudbric
博客园 - 三生石上(FineUI控件)
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
The Hacker News
The Hacker News
美团技术团队
S
SegmentFault 最新的问题
L
Lohrmann on Cybersecurity
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
宝玉的分享
宝玉的分享
The Last Watchdog
The Last Watchdog
Y
Y Combinator Blog
M
MIT News - Artificial intelligence
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Martin Fowler
Martin Fowler
Google Online Security Blog
Google Online Security Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
C
Cybersecurity and Infrastructure Security Agency CISA
T
Tor Project blog
Vercel News
Vercel News
The Cloudflare Blog
G
Google Developers Blog
T
Threat Research - Cisco Blogs
AI
AI
Stack Overflow Blog
Stack Overflow Blog
I
InfoQ
Scott Helme
Scott Helme
S
Schneier on Security
大猫的无限游戏
大猫的无限游戏
The GitHub Blog
The GitHub Blog
S
Securelist
IT之家
IT之家
Microsoft Azure Blog
Microsoft Azure Blog

博客园 - 飞鼠

面试时英语自我介绍范文 判斷一天是否是年月中正確的日 - 飞鼠 - 博客园 Javascript中parseInt的一個問題 NUMERIC(3,1) 的含義 在 google 里找书下载的捷径 - 飞鼠 使用asp.net发送邮件详解 創建用戶控件 - 飞鼠 - 博客园 SQL密码 不斷提醒 datagrid用xml作为数据源,并且有更新,删除和排序的操作(VB) - 飞鼠 - 博客园 将xml作为DataGrid 操作(Sort, Edit, Delete) - 飞鼠 用ASP.NET结合XML制作广告管理程序 用ASP.NET结合XML制作广告管理程序(2) - 飞鼠 - 博客园 XML、DataSet、DataGrid结合写成广告管理程序(下)(转载) - 飞鼠 - 博客园 XML、DataSet、DataGrid结合写成广告管理程序(上)(转载) 将某一目录下的所有相同格式的 XML文件绑定到不同的DataGrid - 飞鼠 - 博客园 创建可编辑的xml文档(之五)执行中的treeview 控件 创建可编辑的xml文档(之四) 删除、改名、插入操作 创建可编辑的xml文档(之三)执行拖放操作
分别用DataGrid、Repeater、DataList绑定XML数据的例子 - 飞鼠 - 博客园
飞鼠 · 2005-12-29 · via 博客园 - 飞鼠

data.aspx

<%@ Import Namespace="System" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.ADO" %>

<script language="VB" runat=server>
Dim ds As DataSet = new DataSet()
   Sub Page_Load(sender As Object, e As EventArgs)
      Dim fs     As FileStream
      Dim reader As StreamReader
      Dim Path   As String
      Path = Server.MapPath( "books.xml" )
      fs = New FileStream(Path, FileMode.Open, FileAccess.Read)
      reader = New StreamReader(fs, Encoding.Default)
      ds.ReadXml(reader)
      Grid1.DataSource = ds.Tables("book").DefaultView
      Grid1.DataBind()
      Repeater1.DataSource = ds.Tables("book").DefaultView
      Repeater1.DataBind()
      DataList1.DataSource = ds.Tables("book").DefaultView
      DataList1.DataBind()
   End Sub

   Sub ChangePage(sender As Object, e As DataGridPageChangedEventArgs)
      Grid1.DataSource = ds.Tables("book").DefaultView
      Grid1.DataBind()
      Repeater1.DataSource = ds.Tables("book").DefaultView
      Repeater1.DataBind()
      DataList1.DataSource = ds.Tables("book").DefaultView
      DataList1.DataBind()
   End Sub

   Sub DataList_ItemCommand(sender As Object, e As DataListCommandEventArgs)
     select case e.CommandSource.Text
    case "详细"
        DataList1.SelectedIndex = e.Item.ItemIndex
     case "关闭"  
        DataList1.SelectedIndex = -1
     end select
     DataList1.DataSource = ds.Tables("book").DefaultView
     DataList1.DataBind()
   End Sub

</script>
<html>
<head>
</head>
<body style="background-color:f6e4c6">
<Form runat="server">
<p>DataGrid演示</p>
<asp:DataGrid
    AllowPaging="True"
    PageSize="10"
    OnPageIndexChanged="ChangePage"
    PagerStyle-HorizontalAlign="Right"
    PagerStyle-NextPageText="下一頁"
    PagerStyle-PrevPageText="上一頁"
    HeaderStyle-BackColor="#AAAADD"
    AlternatingItemStyle-BackColor="#FFFFC0"
    BorderColor="Black"
    CellPadding="2"
    CellSpacing="0"
    id="Grid1" runat="server"/>

<p>Repeater演示</p>
<table border="1">
<asp:Repeater id="Repeater1" runat="server">

<template name="HeaderTemplate" >
<tr align="center"><th >书名</th><th>作者</th><th>价格</th></tr>
</template>

<template name="ItemTemplate">
<tr><td><%# Container.DataItem("title") %></td>
        <td><%# Container.DataItem("last-name") %>  <%# Container.DataItem("first-name") %></td>
        <td><%# Container.DataItem("price") %></td>
</tr>
</template>

</asp:Repeater>
</table>

<p>DataList 演示</p>
<asp:DataList id="DataList1" runat="server"
     Border="1" BorderColor="Black"
     CellPadding="2" CellSpacing="0"
     HeaderStyle-BackColor="#888888"
     ItemStyle-BackColor="#eeeeee"
     SelectedItemStyle-BackColor="#ffffff"
     HeaderTemplate-ColSpan="3"
     OnItemCommand="DataList_ItemCommand" >

<template name="HeaderTemplate" >

</template>

<!--内容模版-->
<template name="ItemTemplate">
书名:<%# Container.DataItem("title") %>
<asp:LinkButton id="detail" runat="server" Text="详细" ForeColor="#333333"/>
</template>

<template name="SelectedItemTemplate">
书名:<%# Container.DataItem("title") %><br>
作者:<%# Container.DataItem("last-name") %>  <%# Container.DataItem("first-name") %><br>
价格:<%# Container.DataItem("price") %><br>
<div align="right"><asp:LinkButton id="Title" runat="server" Text="关闭" ForeColor="#333333"/></div>
</template>

</asp:DataList>

</Form>
</body>
</html>

books.xml
<?xml version="1.0" encoding="gb2312"?>
<NewDataSet>
  <xsd:schema id="NewDataSet" targetNamespace="" xmlns="" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:element name="book">
      <xsd:complexType content="elementOnly">
        <xsd:all>
          <xsd:element name="title" minOccurs="0" type="xsd:string"/>
          <xsd:element name="first-name" minOccurs="0" type="xsd:string"/>
          <xsd:element name="last-name" minOccurs="0" type="xsd:string"/>
          <xsd:element name="price" minOccurs="0" type="xsd:float"/>
        </xsd:all>
      </xsd:complexType>
    </xsd:element>
    <xsd:element name="NewDataSet" msdata:IsDataSet="True">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element ref="book"/>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
<!-- This file represents a fragment of a book store inventory database -->
<bookstore>
  <book genre="autobiography" publicationdate="1981" ISBN="1-861003-11-0">
    <title>The Autobiography of Benjamin Franklin</title>
    <author>
      <first-name>Benjamin</first-name>
      <last-name>Franklin</last-name>
    </author>
    <price>8.99</price>
  </book>
  <book genre="novel" publicationdate="1967" ISBN="0-201-63361-2">
    <title>The Confidence Man</title>
    <author>
      <first-name>Herman</first-name>
      <last-name>Melville</last-name>
    </author>
    <price>11.99</price>
  </book>
  <book genre="philosophy" publicationdate="1991" ISBN="1-861001-57-6">
    <title>The Gorgias</title>
    <author>
      <name>Plato</name>
    </author>
    <price>9.99</price>
  </book>
  <book genre="autobiography" publicationdate="1981" ISBN="1-861003-11-0">
    <title>The Autobiography of Benjamin Franklin</title>
    <author>
      <first-name>Benjamin</first-name>
      <last-name>Franklin</last-name>
    </author>
    <price>8.99</price>
  </book>
  <book genre="autobiography" publicationdate="1981" ISBN="1-861003-11-0">
    <title>The Autobiography of Benjamin Franklin</title>
    <author>
      <first-name>Benjamin</first-name>
      <last-name>Franklin</last-name>
    </author>
    <price>8.99</price>
  </book>
  <book genre="autobiography" publicationdate="1981" ISBN="1-861003-11-0">
    <title>The Autobiography of Benjamin Franklin</title>
    <author>
      <first-name>Benjamin</first-name>
      <last-name>Franklin</last-name>
    </author>
    <price>8.99</price>
  </book>
  <book genre="autobiography" publicationdate="1981" ISBN="1-861003-11-0">
    <title>The Autobiography of Benjamin Franklin</title>
    <author>
      <first-name>Benjamin</first-name>
      <last-name>Franklin</last-name>
    </author>
    <price>8.99</price>
  </book>
  <book genre="autobiography" publicationdate="1981" ISBN="1-861003-11-0">
    <title>The Autobiography of Benjamin Franklin</title>
    <author>
      <first-name>Benjamin</first-name>
      <last-name>Franklin</last-name>
    </author>
    <price>8.99</price>
  </book>
  <book genre="autobiography" publicationdate="1981" ISBN="1-861003-11-0">
    <title>The Autobiography of Benjamin Franklin</title>
    <author>
      <first-name>Benjamin</first-name>
      <last-name>Franklin</last-name>
    </author>
    <price>8.99</price>
  </book>
  <book genre="autobiography" publicationdate="1981" ISBN="1-861003-11-0">
    <title>The Autobiography of Benjamin Franklin</title>
    <author>
      <first-name>Benjamin</first-name>
      <last-name>Franklin</last-name>
    </author>
    <price>8.99</price>
  </book>
  <book genre="autobiography" publicationdate="1981" ISBN="1-861003-11-0">
    <title>The Autobiography of Benjamin Franklin</title>
    <author>
      <first-name>Benjamin</first-name>
      <last-name>Franklin</last-name>
    </author>
    <price>8.99</price>
  </book>
  <book genre="autobiography" publicationdate="1981" ISBN="1-861003-11-0">
    <title>The Autobiography of Benjamin Franklin</title>
    <author>
      <first-name>Benjamin</first-name>
      <last-name>Franklin</last-name>
    </author>
    <price>8.99</price>
  </book>
</bookstore>

</NewDataSet>