前台代码:
1
<asp:Repeater id="parentRepeater" runat="server">
2
<itemtemplate>
3
<b>
4
<%# DataBinder.Eval(Container.DataItem, "Enquiry_No") %>
5
</b>
6
<br>
7
<asp:repeater id="childRepeater"
8
DataSource = <%# Ctype(Container.DataItem,DataRowView).CreateChildView("myrelation") %> runat="server">
9
<itemtemplate>
10
<%# DataBinder.Eval(Container.DataItem, "QuestionName")%>
11
<br>
12
</itemtemplate>
13
</asp:repeater>
14
</itemtemplate>
15
</asp:Repeater>
后台代码:
2

3

4

5

6

7

8

9

10

11

12

13

14

15

1
Dim
ds
As
New
DataSet(
"
dsEnqueiry
"
)
2
Dim
dsTemp
As
New
DataSet
3
Dim
objEnquiry
As
New
Enquiry_Business
4
5
dsTemp
=
objEnquiry.GetAllEnquiry()
6
dsTemp.Tables(
0
).TableName
=
"
Enquiry
"
7
ds.Tables.Add(dsTemp.Tables(
"
Enquiry
"
).Copy)
8
9
dsTemp
=
objEnquiry.GetAllQuestion()
10
dsTemp.Tables(
0
).TableName
=
"
Question
"
11
ds.Tables.Add(dsTemp.Tables(
"
Question
"
).Copy)
12
13
ds.Relations.Add(
"
myrelation
"
, ds.Tables(
"
Enquiry
"
).Columns(
"
Enquiry_No
"
), _
14
ds.Tables(
"
Question
"
).Columns(
"
EnquiryNo
"
))
15
16
Me
.parentRepeater.DataSource
=
ds.Tables(
"
Enquiry
"
).DefaultView
17
Me
.parentRepeater.DataBind()

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17
