Drag n drop - business rules applied

2 posts, 0 answers
  1. Jonas Toft Christensen
    Jonas Toft Christensen avatar
    4 posts
    Member since:
    May 2008

    Posted 31 Mar 2009 Link to this post

    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?
  2. Atanas Korchev
    Atanas Korchev avatar
    8462 posts

    Posted 01 Apr 2009 Link to this post

    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.

    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Back to Top