471,046 Members | 1,321 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

setting SelectedIndex of DataList nested inside of DataList?

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='<%#
((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?
--
Thanks in advance, Les Caudle
May 2 '06 #1
0 1510

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Ashish Sharma | last post: by
4 posts views Thread by V. Jenks | last post: by
1 post views Thread by Joe Blanchard via .NET 247 | last post: by
6 posts views Thread by Paul | last post: by
2 posts views Thread by Laura K | last post: by
7 posts views Thread by =?Utf-8?B?cGF0cmlja2RyZA==?= | last post: by

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.