473,609 Members | 1,874 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Nested DataList Question!

AJ
Hi all,

With the following code in mind :

<asp:DataList ID="dlOne" DataKeyField="m yField1" DataSource="<%#
GetDataSource1( )" Runat="server">
<ItemTemplate >
Output Value Here!
<asp:DataList ID="dlTwo" DataKeyField="m yField2" DataSource="<%#
GetDataSource2( ?,?)" Runat="server">
<ItemTemplate>O utput 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 2657
You can use the ItemDataBound event and the FindControl function to
find the second DataList, example:

Protected Sub dlOne_ItemDataB ound(ByVal sender As Object, ByVal e As
System.Web.UI.W ebControls.Data ListItemEventAr gs) Handles
dlOne.ItemDataB ound

CType(e.Row.Fin dControl("dlTwo "), DataList).DataS ource =
GetDataSource2( ?,?)
CType(e.Row.Fin dControl("dlTwo "), DataList).DataB ind

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.ItemTyp e = ListItemType.It em) Then
End If

Hope this will help.

AJ wrote:
Hi all,

With the following code in mind :

<asp:DataList ID="dlOne" DataKeyField="m yField1" DataSource="<%#
GetDataSource1( )" Runat="server">
<ItemTemplate >
Output Value Here!
<asp:DataList ID="dlTwo" DataKeyField="m yField2" DataSource="<%#
GetDataSource2( ?,?)" Runat="server">
<ItemTemplate>O utput 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
3081
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 label, a radiobuttonlist, etc. I'm driving myself insane trying to figure out how to get
0
1209
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 datalist(inner) to retrieve the DataKey value when a user clicks a link button? 2) Is there anything I should be concerned with about ViewState? This is a reporting tool and no input is accepted. I have found a couple examples but none pointing...
3
1990
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 nested datalist? Thanks for any help.
0
1692
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 OnEditCommand event is raised, I try to do the following: 1. Find the selected datalist item in which the nested datagrid raised the event. (by calling getDataGridReference and returning the DataList's selectedIndex)
3
19333
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 2005 (ASP 2.0) and VB .NET. I have a page with a datalist, a gridview and then other data controls, nested in that order. This all works great, and produces a nice looking page, but I cannot for the life of me figure out how to reference
0
1839
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 my DB changes some value in it (some Total sum from the GridView column). The GridView, along with its ObjectDataSource is inserted into DataList ItemTemplate.
0
1641
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 in the Page_Load. The inner DataList has its DataSource set in the ascx file as: <asp:DataList ID="PageList" runat="server" CellPadding="3" CellSpacing="0" DataSource='<%#...
3
8252
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 datalist, Parent and Child. In the child datalist, I need to get 1 of the values from the parent datalist. I've included the dataaccess code below, only for completeness.
2
2381
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
0
8091
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8579
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8232
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8408
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6064
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5524
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4032
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4098
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1686
muto222
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.