Drag and Drop

7 posts, 0 answers
  1. The KID
    The KID avatar
    24 posts
    Member since:
    May 2008

    Posted 09 Jul 2008 Link to this post

    Can anyone tell me more about the drag and drop feature with the grid? I have a simple grid that i want to be able to reorder the items, and once the items are in correct order i can use a button to loop through and retrieve that order. So far i can only select on a row but when i move the row it goes back to it's original order.

    Thanks
  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 10 Jul 2008 Link to this post

    Hello Mike,

    Please check the description in this example:
    http://www.telerik.com/DEMOS/ASPNET/Prometheus/Grid/Examples/Programming/DragAndDrop/DefaultCS.aspx

    Best wishes,
    Vlad
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. The KID
    The KID avatar
    24 posts
    Member since:
    May 2008

    Posted 29 Jul 2008 Link to this post

    Yes, I have already looked at those. The problem is that in your examples you're using ILists which works fine for your demos because you're not committing any changes to your data. Is there anything out there when you're binding to DataSet and need to bind the order back to the database?
  5. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 31 Jul 2008 Link to this post

    Hi Mike,

    In order to reorder data in the DB you should store the records' order in the backend. For example, by adding a new column to the database table. Then when the order is changed, you should update this column. Please find attached a simple implementation representing the aforementioned approach.

    Best regards,
    Rosen
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Tony
    Tony avatar
    22 posts
    Member since:
    Jun 2005

    Posted 10 Sep 2008 Link to this post

    Hi,

    This demo does not seem to work, the list does not change and the database remains unchanged?

    I have plugged it into my project using the Q2 release of RadGrid.

    Any ideas?

    Tony.
  7. Tony
    Tony avatar
    22 posts
    Member since:
    Jun 2005

    Posted 11 Sep 2008 Link to this post

    Okay, sorry - it does work, but inconsistently.  I especially cannot get the first line to reorder on first page load and it seems limited that you cannot drop a row at the bottom of the grid?
  8. Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 11 Sep 2008 Link to this post

    Hi Tony Hogben,

    You can use the DropPosition property of the RowDrop event's argument object in order to determine if the dragged item should be placed before or after the destination item. And modify the update statement accordingly. You may refer to this Code Library for a possible implementation.

    All the best,
    Rosen
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017