SelectedItems visible

2 posts, 0 answers
  1. Mic
    Mic avatar
    5 posts
    Member since:
    May 2009

    Posted 15 May 2013 Link to this post

    Hi. I use a TreeList with autogenerated columns and I create my TreeList control programmatically in Page_init event.
    I need to show the "selected" Items stored in DB and for this I write my code in Pre_render event.
    I have two critical questions:
    1) is there a way to find an item by his PrimaryKey, without looping all items?
    2) How to ensure visible my selectedItems? I try this but it fail (ie. my parent node remain close ... in my sample code I suppose to have only 2 level)
    void MyCustomTreeList_PreRender(object sender, EventArgs e)    {
    ...
    foreach (var item in this.Items) {
              string pkey = item.GetDataKeyValue(this.DataKeyNames[0]).ToString();
              if (SelectedKey.Contains(pkey))
              {
                item.Selected = true;
    // How to ensure visible????
    //            if (item.ParentItem != null)
    //                item.ParentItem.Expanded = true;  
              }
    ...
            }

    In my case I have no paging and I avoid the "Load on demand" scenario.
    Some suggestion?
    Thanks
    Michela
  2. Angel Petrov
    Admin
    Angel Petrov avatar
    1006 posts

    Posted 17 May 2013 Link to this post

    Hello Michela,

    I have responded to you in the official support ticket. If you want you can share with the community the information provided.

    All the best,
    Angel Petrov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top