setting SelectedIndex of DataList nested inside of DataList?

Discussion in 'ASP .Net' started by Les Caudle, May 2, 2006.

  1. Les Caudle

    Les Caudle Guest

    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
     
    Les Caudle, May 2, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. K Bryan
    Replies:
    4
    Views:
    2,457
    Andrew de la Harpe
    Apr 15, 2004
  2. David Austin via .NET 247
    Replies:
    2
    Views:
    560
    =?Utf-8?B?VHJldm9yIEJlbmVkaWN0IFI=?=
    Jun 7, 2004
  3. Emil
    Replies:
    4
    Views:
    21,759
  4. Nevyn Twyll
    Replies:
    8
    Views:
    1,875
  5. Filip

    Setting SelectedIndex problems

    Filip, Sep 29, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    4,322
    S. Justin Gengo
    Sep 30, 2005
Loading...

Share This Page