Hi!
I am building a TreeView using the TreeNodeExpandMode.WebService expand mode.
When building the nodes in the WebService method, the Category property is missing in the RadTreeNodeData object. The property exists in the RadTreeNode, but not in the RadTreeNodeData.
Is this property missing for any particular reason? And is the any workaround for this issue?
Best Regards,
Christian
4 Answers, 1 is accepted
0
Hi Christian,
You can use your own Custom class to send data from the Web Service to the RadTreeView. The only requirement for this class is that its properties should match those of the RadTreeNode object.
For example, if you had your CustomNodeData class with properties Text, Value and Category, they will be automatically set to the new Nodes added via this Web Service.
Another approach, however, would be to set an Attribute to the RadTreeNodeData object with the respective Category. Later, in the ClientNodePopulating event handler you can set this Attribute as the real Category of the Node.
Sincerely yours,
Simon
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
You can use your own Custom class to send data from the Web Service to the RadTreeView. The only requirement for this class is that its properties should match those of the RadTreeNode object.
For example, if you had your CustomNodeData class with properties Text, Value and Category, they will be automatically set to the new Nodes added via this Web Service.
Another approach, however, would be to set an Attribute to the RadTreeNodeData object with the respective Category. Later, in the ClientNodePopulating event handler you can set this Attribute as the real Category of the Node.
Sincerely yours,
Simon
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Christian
Top achievements
Rank 1
answered on 28 Jul 2008, 07:15 AM
Hi Simon,
Thanks for your reply!
I tried making my own NodeData class, containing Text, Value, ExpandMode and Category properties. The Text, Value and ExpandMode properties are set correctly on the TreeNode. But the Category property is not set correctly and is null.
I also tried your second approach and saved the Category in the Attributes collection. I can retrieve this data in the ClientNodePopulating client side method, but the RadTreeNode client object dosen't have any set_category() method.
Any other ideas?
Best Regards,
Christian
Thanks for your reply!
I tried making my own NodeData class, containing Text, Value, ExpandMode and Category properties. The Text, Value and ExpandMode properties are set correctly on the TreeNode. But the Category property is not set correctly and is null.
I also tried your second approach and saved the Category in the Attributes collection. I can retrieve this data in the ClientNodePopulating client side method, but the RadTreeNode client object dosen't have any set_category() method.
Any other ideas?
Best Regards,
Christian
0
Accepted
Hi Christian,
Thank you for getting back to me.
Indeed, the Category was not set in this case. As for the client-side RadTreeNode object's set_category() function - it exists but it is not documented - something which we will fix right away.
As a workaround to the issue, I suggest you use the new client-side event of RadTreeView (in version Q2) - OnClientNodeDataBound, which fires for each Node that is bound via Web Service. It has the get_dataItem() function which returns an object with the same properties as the NodeData (in your case) object. You can use this event to set the category of each Node.
Finally, your Telerik points have been updated for the report.
Sincerely yours,
Simon
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Thank you for getting back to me.
Indeed, the Category was not set in this case. As for the client-side RadTreeNode object's set_category() function - it exists but it is not documented - something which we will fix right away.
As a workaround to the issue, I suggest you use the new client-side event of RadTreeView (in version Q2) - OnClientNodeDataBound, which fires for each Node that is bound via Web Service. It has the get_dataItem() function which returns an object with the same properties as the NodeData (in your case) object. You can use this event to set the category of each Node.
Finally, your Telerik points have been updated for the report.
Sincerely yours,
Simon
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Christian
Top achievements
Rank 1
answered on 29 Jul 2008, 01:56 PM
Hi Simon,
Thanks for your response. Your suggestion helped. I upgraded to Q2 and used the following JS code:
Thanks for your response. Your suggestion helped. I upgraded to Q2 and used the following JS code:
function
TreeView_NodeDataBound(sender, eventArgs)
{
var node = eventArgs.get_node();
var dataItem = eventArgs.get_dataItem();
node.set_category(dataItem.Category);
}
Thanks for your help!
Christian