Hello Sam,
Welcome to ASPNET newsgroup.
From your description, you're wantting to display some data on the ASP.NET
2.0 web page through the DataList control, and since those data records can
be grouped by some certain category field, you'd like to display the main
category items in the DataList and in each DataList item , use a GridView
to display those sub detailed items belong to each category value(just like
the Category/Product.... table in NorthWind...), yes? If anything I didn't
get correctly, please feel free to let me know.
Based on my understanding, the current ASP.NET 2.0 DataSource
control/DataBound control's relationship model require that the DataSource
control directly provide the records be bound to databound control, then we
declare some bound fields...
For nested databound (GridView nested in GridView or GridView nested in
DataList.....), if we still want to use declarative bound with out code, we
have to put another nested DataSource control in the primary (toplevel)
databound control's ItemTemplate... And the nested DataBound control can
be associated to that nested datasource control.........
For your scenario, if you want to reuse the Data collection return from the
webservice, and don't want additional data retrieving in each
ItemTemplate's databinding, I'm afraid we have to manually use code to fill
out different datasource from the Main datasource (retrieved from
webservice....). e.g, the webservice return a DataTable, we first
programmatically select all the distinct categories from it and bind the
categories collection with DataList, and in each ItemTemplate, we use the
category id to querty that dataset again to retrieve the products belong to
that category. Just what we also need to do in ASP.NET 1.X ...
How do you thinks of this? If you have any other ideas or question, please
feel free to post here.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Sam Loveridge" <>
| Subject: VS2005 DataList with Nested GridView using ObjectDataSource
| Date: Wed, 30 Nov 2005 16:08:18 +1030
| Lines: 31
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontro ls
| NNTP-Posting-Host: 203.33.102.104
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP15.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.webcontro ls:31391
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontro ls
|
| Hi All.
|
| I have been loving the easy binding of a straight forward GridView
directly
| to a web service method using the ObjectDataSource, however I've come
into a
| tangle trying to apply a more complex binding solution with a DataList.
|
| Let's say the simple method described above is a full list of items with
a
| customer number in a grid (call it QUERY A). What I want to do is use the
| same data source for QUERY A to display a DataList that groups items by
| customer details.
|
| What I have established is a DataList that binds to a customer query to
| display more detailed customer information as the primary data source for
| the DataList (QUERY B), but within its ItemTemplate I want to display a
| GridView for each customer to display their items. Ideally this sub query
| should be based on the data from QUERY A so I don't have to load it all
| again, making the switching between the full list and the grouped by
| customer views faster.
|
| This sounds like your classic master/slave query, where the data source
for
| the nested GridView in the DataList is driven from a value in the
DataList
| control for the customer ID, but how do I create a data source for my
QUERY
| A data to allow the funky VS2005 binding with minimal code-behind?
|
| Any ideas?
|
| Thanks in advance,
|
| Sam.
|
|
|