Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested DataLists

Status
Not open for further replies.

malonep

Programmer
Jul 14, 2004
44
CA
Hi,

I am trying to create a page with nested data lists to show nested information.

I have a stored procedure that returns a data set with 4 tables in it.

I am creating the data relations as follows
Code:
oRelation = New DataRelation("ReportPeriods", oDS.Tables(0).Columns("iClassID"), oDS.Tables(1).Columns("iClassID"), False)
            oRelation.Nested = True
            oDS.Relations.Add(oRelation)
            oRelation = New DataRelation("Categories", oDS.Tables(1).Columns("iReportPeriodID"), oDS.Tables(2).Columns("iReportPeriodID"), False)
            oRelation.Nested = True
            oDS.Relations.Add(oRelation)
            oRelation = New DataRelation("Tasks", oDS.Tables(2).Columns("cCategoryID"), oDS.Tables(3).Columns("ccategoryID"), False)
            oRelation.Nested = True
            oDS.Relations.Add(oRelation)
 dlClass.DataSource = oDS
 dlClass.DataBind()

and in the nested datalist
Code:
<asp:DataList id="dlReportPeriod" runat="server" DataSource='<%#Container.DataItem.Row.GetChildRows("ReportPeriods")%>'>

When I add one data relation and display the corresponding datalist it works. As soon as I try to add the second relation I get the error
"Public member 'Row' on type 'DataRow' not found."

Any help would be appreciated
 
You should cast the DataItem to DataRowView:
((DataRowView)Container.DataItem).Row.GetChildRows("ReportPeriods");
obislavu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top