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

Drag n drop - business rules applied

1 Answer 188 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jonas Toft Christensen
Top achievements
Rank 1
Jonas Toft Christensen asked on 31 Mar 2009, 10:49 AM
Im working with a load-on-demand using webservice treeview and I have some business rules that I want to run in a drag n drop context. All my business rules are implemented server side.

This means that I want to:

1. Disable drag / drop for specific nodes when first adding the node. I currently do this using the OnNodeDatabound event. This works fine for me, although it would be easier to do it server side. I am calling my load-on-demand webservice where I would like to do the work.
2. Disable drop depending on the node that the source is dragged onto based on server side logic. I have not been able to find out how to cancel the drop based on a server-side condition.
3. Provide the user with necessary GUI & error messages depending on the rules.

An example:
After a drop, I find out that the destination node returns false for a specific rule. This means that I have to cancel the drop and give the user a message "Cannot move node xxx because rule yyy failed"

Can you help me out with this?

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 01 Apr 2009, 09:22 AM
Hi Jonas Toft Christensen,

Since the drag and drop is a client-side operation you cannot use server-side code to validate your business rules. You can control the drag and drop behavior by using the following RadTreeNode properties:
  • AllowDrop - when set to false the user cannot drop over the node
  • AllowDrag - when set to false the user cannot drag the node
Additionally you can cancel the OnClientNodeDropping event based on your custom logic.

I recommend you move the validation logic on the client-side backed up by server validation as well. You can use the custom attributes of the nodes to associate additional data.

Regards,
Albert
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
TreeView
Asked by
Jonas Toft Christensen
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or