标题:为什么dr中有数据,到dt中就看不见呢,显示空白??
只看楼主
jack_xu2046
Rank: 2
等 级:论坛游民
帖 子:72
专家分:11
注 册:2008-10-1
结帖率:81.82%
已结贴  问题点数:0 回复次数:1 
为什么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>
搜索更多相关主题的帖子: 空白 数据 看不见 
2010-12-22 02:02
kevintang
Rank: 4
等 级:业余侠客
威 望:9
帖 子:799
专家分:236
注 册:2008-2-14
得分:10 
dt.Rows.Add(dt) 你的
 dt.Rows.Add(dr)  我的!
mlgb!

编程少年基地——少年编程者的练兵场
http://bcsn.    招聘版主中

2010-12-22 10:04



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-329547-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.075658 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved