为什么dr中有数据,到dt中就看不见呢,显示空白??
<%@page Language ="VB" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<script runat ="server" >
Dim BindedVar As String = "Hello 2.0"
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
If Not IsPostBack Then
Dim dt As New Data.DataTable()
Dim dr As Data.DataRow
dt.Columns.Add(New Data.DataColumn("姓名", GetType(System.String)))
dt.Columns.Add(New Data.DataColumn("年龄", GetType(System.Int32)))
Dim i As Integer
For i = 0 To 8
dr = dt.NewRow()
dr(0) = i.ToString()
dr(1) = 10 * (i + 1)
dt.Rows.Add(dt)
Next
Dim dv As New Data.DataView(dt)
GridView1.DataSource = dv
Dim xmldata As String
xmldata = "<root>" + _
"<item><name>孟子E章</name><url>http://www.baidu.com></url></item>" + _
"<item><name>播客网站</name><url>http://www. + _
"<item><name>技术社区</name><url>http://community. + _
"</root>"
Dim doc As System.Xml.XmlDocument = New System.Xml.XmlDocument()
doc.LoadXml(xmldata)
rp.DataSource = doc.SelectNodes("/root/item")
Me.DataBind()
End If
End Sub
</script>
<html xmlns="http://www.
<head runat="server">
<title>程序测试代码</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<%#BindedVar %>
<hr />
<asp:GridView ID ="GridView1" runat ="server" AutoGenerateColumns ="false" >
<Columns >
<asp:TemplateField HeaderText ="表格列标题">
<ItemTemplate >
姓名:<%#Eval("姓名")%>,年龄:<%#Eval("年龄")%>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<hr />
<asp:Repeater ID ="rp" runat ="server" >
<ItemTemplate >
<div>
<a href ='<%#XPath("url") %>'>
<%#Xpath("name") %>
</a>
</div>
</ItemTemplate>
</asp:Repeater>
<hr />
</div>
</form>
</body>
</html>