一
本文描述如何使用嵌套的Repeater 控件來顯示分級數據
二
<itemtemplate>
<b><%# DataBinder
</itemtemplate>
public void Page_Load()
{
SqlConnection cnn = new SqlConnection(
SqlDataAdapter cmd
DataSet ds = new DataSet();
cmd
//這裡將要插入子表的數據綁定
parent
Page
cnn
}
using System
三
<asp:repeater id=
<itemtemplate>
<%# DataBinder
</itemtemplate>
</asp:repeater>
<asp:repeater
<%@ Import Namespace=
在
SqlDataAdapter cmd
cmd
ds
ds
ds
PS
BU
BU
PC
BU
TC
四
Nestedrepeater
<%@ Page Language=C# Inherits=
<%@ Import Namespace=
<html>
<body>
<form runat=server>
<!
<asp:repeater id=
<itemtemplate>
<b><%# DataBinder
<!
<asp:repeater id=
<itemtemplate>
<%# DataBinder
</itemtemplate>
</asp:repeater>
<!
</itemtemplate>
</asp:repeater>
<!
</form>
</body>
</html>
Nestedrepeater
using System;
using System
using System
using System
using System
using System
using System
namespace yourprojectname
{
public class nestedrepeater : System
{
protected System
public nestedrepeater()
{
Page
}
public void Page_Load(object sender
{
//Create the connection and DataAdapter for the Authors table
SqlConnection cnn = new SqlConnection(
SqlDataAdapter cmd
//Create and fill the DataSet
DataSet ds = new DataSet();
cmd
//Create a second DataAdapter for the Titles table
SqlDataAdapter cmd
cmd
//Create the relation bewtween the Authors and Titles tables
ds
ds
ds
//Bind the Authors table to the parent Repeater control
parent
Page
//Close the connection
cnn
}
private void Page_Init(object sender
{
InitializeComponent();
}
private void InitializeComponent()
{
this
}
}
}
From:http://tw.wingwit.com/Article/program/net/201311/15734.html