L
Les Caudle
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:
<aspataList ID="PageList" runat="server" CellPadding="3" CellSpacing="0"
DataSource='<%#
((DataRowView)Container.DataItem).Row.GetChildRows("CategoryPagesRelation") %>'
The inner DataList is inside the SelectedItemTemplate of the outer DataList.
The inner DataList sub-menu displays inside the outer DataList, but there is a
problem with selecting an item inside the inner DataList.
Inside the PageLoad, the outer DataList has its SelectedIndex set before its
DataSource is set and DataBind is called.
This works, however - inner DataList's SelectedIndex cannot be set after the
outer DataList's DataBind as it will not be visible - and it cannot be set
before it as the object doesn't yet exist.
My guess is that the inner DataList's SelectedIndex must be set inside an
ItemDataBound of the outer DataList - but I'm not sure how to do this.
Any ideas on how to get this to work?
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:
<aspataList ID="PageList" runat="server" CellPadding="3" CellSpacing="0"
DataSource='<%#
((DataRowView)Container.DataItem).Row.GetChildRows("CategoryPagesRelation") %>'
The inner DataList is inside the SelectedItemTemplate of the outer DataList.
The inner DataList sub-menu displays inside the outer DataList, but there is a
problem with selecting an item inside the inner DataList.
Inside the PageLoad, the outer DataList has its SelectedIndex set before its
DataSource is set and DataBind is called.
This works, however - inner DataList's SelectedIndex cannot be set after the
outer DataList's DataBind as it will not be visible - and it cannot be set
before it as the object doesn't yet exist.
My guess is that the inner DataList's SelectedIndex must be set inside an
ItemDataBound of the outer DataList - but I'm not sure how to do this.
Any ideas on how to get this to work?