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