473,324 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Strongly typed datasets and nested repeaters

I have a strongly typed dataset that returns two tables - "items" and
"itemdetails". In the strongly-typed dataset designer, I've created a link
(relationship) between the two tables based on a foreign key.

I want to put them into a nested repeater, but I'm having problems finding a
"nice" way of doing it.

Can someone please point me in the direction of a tutorial or best practice
to achieve this?

Thanks in advance,

Duncan
Nov 17 '05 #1
3 5425
assign the "Items" table to the outter repeater, then in the
OnItemDataBound event handler:

switch (e.Item.ItemType){
case ListItemType.Item: case ListItemType.AlternatingItem:
Repeater ir = e.Item.FindControl("rptInnerRepeater")
ir.DataSource =
((DataRowView)e.Item.DataItem).CreateChildView("It emDetailDataRelation");
ir.DataBind();
}

hope that helps

Nov 17 '05 #2
Thanks for your reply; I saw this example on the web, but I'm unsure where
the ItemDetailDataRelation comes from. I tried all the relationship names
that were in the strongly-typed dataset designer, but they gave an error.

I got the impression that if you were doing it between two datatables, that
would be the name of the Relations.Add(... but I couldn't seem to create a
programatic relationship between two fields in a strongly typed dataset.

Duncan

"bfking" <bf****@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
assign the "Items" table to the outter repeater, then in the
OnItemDataBound event handler:

switch (e.Item.ItemType){
case ListItemType.Item: case ListItemType.AlternatingItem:
Repeater ir = e.Item.FindControl("rptInnerRepeater")
ir.DataSource =
((DataRowView)e.Item.DataItem).CreateChildView("It emDetailDataRelation");
ir.DataBind();
}

hope that helps

Nov 17 '05 #3
The relation is set up in the dataset.

something like
_myDataSet.Relations.Add("Users_Results", _myDataSet.TableA.UsersNameColumn,
_myDataSet.TableB.UsersNameColumn);

where _myDataSet is your strongly typed DataSet.
in your nested Repeater you would then do something like this:

<asp:repeater id="_reportoutput" Runat="server">

....templates

//nested repeater
<asp:repeater id="_nextstuff" Runat="server" DataSource='<%#
GetChildRelation(Container.DataItem,"Users_Results ")%>'>
with the following in your code behind:

public static DataView GetChildRelation(object dataItem, string relation)
{
DataRowView drv = dataItem as DataRowView;
if (drv != null)

return drv.CreateChildView(relation);
else
return null;
}
MattC
"Duncan Welch" <du**@ntpcl.f9.co.uk> wrote in message
news:us*************@TK2MSFTNGP10.phx.gbl...
Thanks for your reply; I saw this example on the web, but I'm unsure where
the ItemDetailDataRelation comes from. I tried all the relationship names
that were in the strongly-typed dataset designer, but they gave an error.

I got the impression that if you were doing it between two datatables,
that
would be the name of the Relations.Add(... but I couldn't seem to create a
programatic relationship between two fields in a strongly typed dataset.

Duncan

"bfking" <bf****@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
assign the "Items" table to the outter repeater, then in the
OnItemDataBound event handler:

switch (e.Item.ItemType){
case ListItemType.Item: case ListItemType.AlternatingItem:
Repeater ir = e.Item.FindControl("rptInnerRepeater")
ir.DataSource =
((DataRowView)e.Item.DataItem).CreateChildView("It emDetailDataRelation");
ir.DataBind();
}

hope that helps


Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Job Lot | last post by:
I am confused how strongly typed dataset is different from un-typed dataset. Is there any good link explaining pros and cons of both? Which one should be used preferably?
3
by: MC D | last post by:
I have a situation in which I have a strongly typed dataset based on the schema of a xml document. This works great, and OMG I love strongly typed datasets... ;o) However, The situation I have...
7
by: Jeff | last post by:
I want to remote several strongly typed datasets and I don't want to distribute the assemblies. I wish to create interface assemblies for these datasets but I don't know where to start. I've...
2
by: David | last post by:
I have been developing applications with Java for quite a while but I am new to .NET development. I am trying to learn the ".NET way" of creating Strongly Typed Objects from a database. The...
1
by: HardBap | last post by:
I've created a strongly typed DataSet (Customers.xsd) using the xsd.exe tool. I want to be able to access fields using ds.Customer.CompanyName. The problem is when I return this DataSet from a...
0
by: Greg | last post by:
I am working on an application that requires working with numbers in scientific notation. I am using SqlServer as the database and I have created strongly typed data adapters and datasets. The...
3
by: Duncan Welch | last post by:
I have a strongly typed dataset that returns two tables - "items" and "itemdetails". In the strongly-typed dataset designer, I've created a link (relationship) between the two tables based on a...
1
by: Mike P | last post by:
I have been trying out using strongly typed datasets in VS 2005, and I have to say that I don't like them...they produce loads of auto-generated code, and I would much rather create a single class...
4
by: Rachana | last post by:
Hi, I have understood Data Sets but what is meant by typed/untyped/ strongly typed datasets. Can any one explain me or suggest any site/ article, to get these concepts (and their ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.