TreeList validation on Dropping

2 posts, 0 answers
  1. Abilash
    Abilash avatar
    1 posts
    Member since:
    Nov 2011

    Posted 06 Mar 2012 Link to this post

    I am having a RadTreeList control in my page. I need to validate that every first hierarchy items(0th Nested Level items) can have only 5 levels of children( not 5 children) i.e., each 0th Nested Level items can have 5 hierarchical levels. I am using both item creation method and drag-drop method. While dragging from some item to an item, I need to validate that the destination item has only 5 hierarchical levels after dropping. If the sum of hierarchical levels is equal or greater than 5, then the dragged item should not be allowed to drop to the destination item.
    Can anyone help for this.

    Thanks in Advance,
  2. Daniel
    Daniel avatar
    4949 posts

    Posted 09 Mar 2012 Link to this post

    Hi Abilash,

    You can get the child items of a given row on RowDropping and decide whether to cancel the dropping action or not. Client-side TreeListDataItem object has a get_childItems() property that will return a collection of the child items.
    It is possible to use get_childItems().length to count them. Note that the client-side item objects do not exist initially. They will be created automatically when you call the get_dataItems() property.

    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