473,473 Members | 2,039 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 19 '05 #1
3 1296
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 19 '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 19 '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 19 '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...
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...
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...
1
by: herbert | last post by:
Does VS.2005 support strongly typed datasets between PocketPC and Web Services? I have a project stalled and must decide whether to wait for VS.2005 or go back to untyped DataSets. thanks...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.