473,414 Members | 1,623 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,414 software developers and data experts.

Nested DataList Question!

AJ
Hi all,

With the following code in mind :

<asp:DataList ID="dlOne" DataKeyField="myField1" DataSource="<%#
GetDataSource1()" Runat="server">
<ItemTemplate>
Output Value Here!
<asp:DataList ID="dlTwo" DataKeyField="myField2" DataSource="<%#
GetDataSource2(?,?)" Runat="server">
<ItemTemplate>Output Value Here!</ItemTemplate>
</asp:DataList>
</ItemTemplate>
</asp:DataList>

I need to send the Data Source of the nested DataList (DataSource="<%#
GetDataSource2(?,?)) two variables.

1) myField2 value of current DataList
2) myField1 value of parent DataList

Using Databinding?

Can anyone give a head on on acheiving this???

Cheers,
Adam

Jul 20 '06 #1
1 2644
You can use the ItemDataBound event and the FindControl function to
find the second DataList, example:

Protected Sub dlOne_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataListItemEventArgs) Handles
dlOne.ItemDataBound

CType(e.Row.FindControl("dlTwo"), DataList).DataSource =
GetDataSource2(?,?)
CType(e.Row.FindControl("dlTwo"), DataList).DataBind

End Sub

So, in the first DataList you can put a hidden label in the header with
the id of the parent DataList and in each row put the value of the
current DataList. Just check if the item is a Item, Alternate item,
header item, etc. like this:

If (e.Item.ItemType = ListItemType.Item) Then
End If

Hope this will help.

AJ wrote:
Hi all,

With the following code in mind :

<asp:DataList ID="dlOne" DataKeyField="myField1" DataSource="<%#
GetDataSource1()" Runat="server">
<ItemTemplate>
Output Value Here!
<asp:DataList ID="dlTwo" DataKeyField="myField2" DataSource="<%#
GetDataSource2(?,?)" Runat="server">
<ItemTemplate>Output Value Here!</ItemTemplate>
</asp:DataList>
</ItemTemplate>
</asp:DataList>

I need to send the Data Source of the nested DataList (DataSource="<%#
GetDataSource2(?,?)) two variables.

1) myField2 value of current DataList
2) myField1 value of parent DataList

Using Databinding?

Can anyone give a head on on acheiving this???

Cheers,
Adam
Jul 21 '06 #2

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

Similar topics

4
by: V. Jenks | last post by:
What seems like a simple thing is apparently not so straightforward? I have a datalist. Inside of that datalist is an <itemtemplate> secion which contains other server controls such as a...
0
by: Marty U. | last post by:
I have two datalists nested. On the ItemDataBound Event of the first datalist I databind the second with specific info. A couple questions: 1) How can I utilize the OnItemCommand of the nested...
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 question then is...how do I get the value from the...
0
by: Chris | last post by:
I've been searching all over and think I am close, but keep getting the error "Index out of range" when trying to reference a nested datagrid when an OnEditCommand event is raised. When the...
3
by: Martin | last post by:
Hi, I have a very frustrating problem that I have researched for countless hours to no avail. There are many posts asking very similar things, however none usefull in my situation. I am using VS...
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 GridView is nested, since after update, trigger in...
0
by: Les Caudle | last post by:
I have a menu system composed of a DataList nested inside a DataList. The outer DataList has it's DataSource (composed of a DataSet with two tables linked by a CategoryPagesRelation Relation) set...
3
by: mroffey | last post by:
Hi everyone, I've been having this problem and I've searched high and low, but I can't seem to find the answer to what is probably a very simple solution. In a nutshell, I have a nested...
2
by: Ole V.-M. | last post by:
Greetings, i have a UserControl, that contains a DataList. That DataList contains as items other DataLists. example: DataList A Row 1 Nested DataList 1 Row 1
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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
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...

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.