TreeListCalculatedColumn raise exception if RadTreeList AllowLoadOnDemand = true

4 posts, 0 answers
  1. Robert
    Robert avatar
    17 posts
    Member since:
    Jun 2012

    Posted 19 Sep 2012 Link to this post

    Hi,



    I think I found a bug on TreeListCalculatedColumn when using on demand loading on a treelist



    If a RadTreeList control is configured with AllowLoadOnDemand and a TreeListCalculatedColumn is defined within its column définitions and exception "The given key was not present in the dictionary." is raised by TreeListCalculatedColumn.OnColumnDataCellBinding(Object sender, EventArgs e) +314



    I have a sample project to repro this behavior if required



    Rgds

  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 24 Sep 2012 Link to this post

    Hello Robert,

    Please note that in case AllowLoadOnDemand is set to rue for the RadTreeListControl except of assigning datasource in NeedDataSource event for the control you should handle the RadTreeList.ChildItemsDataBind event and select the subset of items related to the expanded item. See the help topic below and verify if you follow the correct logic for achieving the required functionality:
    http://www.telerik.com/help/aspnet-ajax/treelist-load-on-demand.html

    Kind regards,
    Maria Ilieva
    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
  4. Robert
    Robert avatar
    17 posts
    Member since:
    Jun 2012

    Posted 24 Sep 2012 Link to this post

    Hi Maria,

    I do handle both event NeedDataSource and ChildItemsDataBind


    protected
    void MyRadTreeList_NeedDataSource(object sender, TreeListNeedDataSourceEventArgs e)
     {   
         MyTreeList.DataSource = DataManager.Current.GetData();
         Debug.WriteLine("TreeList_NeedDataSource");
     }
     protected void MyRadTreeList_OnChildItemsDataBind(object sender, TreeListChildItemsDataBindEventArgs e)
     {
         int l_parentId = Convert.ToInt32(e.ParentDataKeyValues["Id"].ToString());
         e.ChildItemsDataSource = DataManager.Current.GetData(l_parentId);
         Debug.WriteLine(string.Format("TreeList_OnChildItemsDataBind:[{0}] ", l_parentId));
     }

    <telerik:RadTreeList ID=MyTreeList runat="server" DataKeyNames="Id" ParentDataKeyNames="ParentId"
                   AllowLoadOnDemand="false" AutoGenerateColumns="False"
                   OnNeedDataSource="MyRadTreeList_NeedDataSource"
                   OnChildItemsDataBind="MyRadTreeList_OnChildItemsDataBind">
               <Columns>
                   <telerik:TreeListBoundColumn DataField="Id" HeaderText="Id" />
                   <telerik:TreeListBoundColumn DataField="Name"  HeaderText="Name" />
                   <telerik:TreeListBoundColumn DataField="Value1"  HeaderText="Value1" />
                   <telerik:TreeListBoundColumn DataField="Value2" HeaderText="Value2"  />
                   <telerik:TreeListCalculatedColumn DataFields="Value1,Value2" Expression="{0}+{1}" HeaderText="Sum" UniqueName="SumColumn" />
               </Columns>
           </telerik:RadTreeList>
     Column <telerik:TreeListCalculatedColumn DataFields="Value1,Value2" Expression="{0}+{1}" HeaderText="Sum" UniqueName="SumColumn" />  raises an exception.
  5. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 27 Sep 2012 Link to this post

    Hello Robert,

    I further tested the described scenario on my end and it appears that the issue you are facing is a bug in the RadTreeList control. I already logged it in our tracking system and our dev team will do their best to provide a fix as soon as possible.

    Thank you for reporting this issue. As a token of gratitude I'm updating your Telerik points.

    All the best,
    Maria Ilieva
    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.
Back to Top