This is a migrated thread and some comments may be shown as answers.

TreeListCalculatedColumn raise exception if RadTreeList AllowLoadOnDemand = true

3 Answers 64 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 19 Sep 2012, 09:36 AM
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

3 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 24 Sep 2012, 10:56 AM
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.
0
Robert
Top achievements
Rank 1
answered on 24 Sep 2012, 11:58 AM
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.
0
Maria Ilieva
Telerik team
answered on 27 Sep 2012, 10:29 AM
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.
Tags
TreeList
Asked by
Robert
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Robert
Top achievements
Rank 1
Share this question
or