472,333 Members | 1,061 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Bind nested datalist to objectdatasource

I have a datalist (DataList1)...
with an itemtemplate...
then a table - server side (Table1)...
then another datalist (DataList2)...
another itemtemplate...
another table - server side (Table2)

DataList1 is bound to an objectdatasource (ObjectDataSource1), and has a
datakey (CategoryId). I want to bind DataList2 to another objectdatasource
(ObjectDataSource2), pulling records based on DataList1's datakey
(CategoryId).

I've set everything up, but when i run the page only DataList1 appears to
databind. Table1 renders out, but DataList2 never seems to databind.

I'm trying to do everything declaritively, is that possible? If so, what am
I doing worng?

Thanks
Jan 27 '06 #1
2 3344
Make sure that the datasource for DataList2 is within the same template that
the DataList2 is placed, because for each datalist2 instance there will be an
instance of the datasource created. I have a demo that achieved the same
declaratively albeit using a parent GridView that expands a child GridView
that in turn expands a DetailsView.
http://www.webswapp.com/CodeSamples/...idView_1c.aspx

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Phil" wrote:
I have a datalist (DataList1)...
with an itemtemplate...
then a table - server side (Table1)...
then another datalist (DataList2)...
another itemtemplate...
another table - server side (Table2)

DataList1 is bound to an objectdatasource (ObjectDataSource1), and has a
datakey (CategoryId). I want to bind DataList2 to another objectdatasource
(ObjectDataSource2), pulling records based on DataList1's datakey
(CategoryId).

I've set everything up, but when i run the page only DataList1 appears to
databind. Table1 renders out, but DataList2 never seems to databind.

I'm trying to do everything declaritively, is that possible? If so, what am
I doing worng?

Thanks

Jan 27 '06 #2
Thanks for the reply. I didn't realize that the position of the
objectdatasource control mattered, but apparently it does. The only
difference here is that I wanted to do the databinding without a selection
occuring (meaning there is no SelectedIndex for me to reference). I solved
this problem by putting a Label control in the first datalist and binding the
text property to the categoryId (but made the label control hidden). Then I
used the controlparameter of the second object datasource and referenced the
text property of the label.

I read that part of the solution last night somewhere, don't remember where
as I wasn't able to get it working then (likely due to the position of the
datasource control).

All-in-all, everything seems to be working now. Thanks again for the reply,
and nice samples on your site there.

Thanks.

"Phillip Williams" wrote:
Make sure that the datasource for DataList2 is within the same template that
the DataList2 is placed, because for each datalist2 instance there will be an
instance of the datasource created. I have a demo that achieved the same
declaratively albeit using a parent GridView that expands a child GridView
that in turn expands a DetailsView.
http://www.webswapp.com/CodeSamples/...idView_1c.aspx

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Phil" wrote:
I have a datalist (DataList1)...
with an itemtemplate...
then a table - server side (Table1)...
then another datalist (DataList2)...
another itemtemplate...
another table - server side (Table2)

DataList1 is bound to an objectdatasource (ObjectDataSource1), and has a
datakey (CategoryId). I want to bind DataList2 to another objectdatasource
(ObjectDataSource2), pulling records based on DataList1's datakey
(CategoryId).

I've set everything up, but when i run the page only DataList1 appears to
databind. Table1 renders out, but DataList2 never seems to databind.

I'm trying to do everything declaritively, is that possible? If so, what am
I doing worng?

Thanks

Jan 27 '06 #3

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

Similar topics

3
by: Derek | last post by:
I have a nested datalist with a dropdownlist. I need to capture the selectedvalue of the dropdownlist so I can update a database table. My...
0
by: H5N1 | last post by:
Hi there My problem is that in when I update GridView row, which is nested into DataList control, I want to refresh also DataList in which the...
1
by: H5N1 | last post by:
Hello everybody I'm stuck for a long time with the following problem, so I will be really gratefull if you could help me a bit: I have a...
1
by: Jules | last post by:
We have a problem setting, actually resetting, the SelectedItemTemplate of a DataList control. Below is the ObjectDataSource and the DataList in...
0
by: TheDude5B | last post by:
HI, I am creating a DataList by using the SelectMethod from an ObjectDataSource. Within each item I want to be able to the dynamically create a...
0
by: GMartin | last post by:
I have a pop-up form with a three columned Grid that has checkboxes in a Template Column in the first/left-most column. (The form is to allow...
0
by: Mark Micallef | last post by:
Hi, I'm having a problem using a databound dropdownlist inside a reorderlist ajax control. Here's a snippet of the code I'm using: ...
1
by: Mark Micallef | last post by:
Hi, this question relates to a control in the Ajax toolkit for asp.net 2. I'm having a problem using a databound dropdownlist inside a reorderlist...
0
by: nzkks | last post by:
Hi, I am using these: ASP.Net 2.0, VB.Net, Visual Studio 2005, SQL Server 2005, Objectdatasource using DAL & BLL classes My objectdatasource can...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

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.