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. Advertisements

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. Mark
    Replies:
    0
    Views:
    947
  2. Nevyn Twyll
    Replies:
    8
    Views:
    2,341
  3. schapopa
    Replies:
    1
    Views:
    684
    schapopa
    Jan 12, 2006
  4. Mike
    Replies:
    1
    Views:
    1,977
    Keith Patrick
    Jan 12, 2006
  5. H5N1
    Replies:
    0
    Views:
    2,994
  6. Crazy Cat
    Replies:
    2
    Views:
    1,403
    Crazy Cat
    Sep 10, 2007
  7. Mike
    Replies:
    1
    Views:
    217
    Keith Patrick
    Jan 12, 2006
  8. Mike
    Replies:
    1
    Views:
    250
    Keith Patrick
    Jan 12, 2006
Loading...