How to save the sequence in the database after dragging dropping
i have this code which is interchanging images location as soon as they are clicked and dragged and place on the other image below is the javascript code and i am using jquery ui for this
- <script >
- (function () {
- var droppableParent;
- $('ul .element').draggable({
- revert: 'invalid',
- revertDuration: 200,
- start: function () {
- droppableParent = $(this).parent();
- $(this).addClass('being-dragged');
- },
- stop: function () {
- $(this).removeClass('being-dragged');
- }
- });
- $('ul li').droppable({
- hoverClass: 'drop-hover',
- drop: function (event, ui) {
- var draggable = $(ui.draggable[0]),
- draggableOffset = draggable.offset(),
- container = $(event.target),
- containerOffset = container.offset();
- $('.element', event.target).appendTo(droppableParent).css({ opacity: 0 }).animate({ opacity: 1 }, 200);
- draggable.appendTo(container).css({ left: draggableOffset.left - containerOffset.left, top: draggableOffset.top - containerOffset.top }).animate({ left: 0, top: 0 }, 200);
- }
- });
- }());
- </script>
this is the code in .aspx page
- <div >
- <asp:DataList ID="DataList1" runat="server" RepeatColumns="5" CellPadding="4" CellSpacing="10" AllowSorting="True" OnItemCommand="DataList1_ItemCommand">
- <ItemTemplate>
- <%-- <table width="90%" >
- <ul>
- <tr>
- <td>
- <li >
- <div class="element">
- <asp:ImageButton CssClass="element" ID="ImageButton1" CommandArgument='<%#Eval("D_NAME") %>' runat="server" Height="300px" Width="250px" ImageUrl='<%#Eval("D_IMAGE") %>' />
- <br /></td>
- </div>
- </li>
-
- <td><br /></td>
- </tr>
- <ul>
- </table>--%>
- <ul>
- <li>
- <div class="element">
- <asp:LinkButton ID="LinkButtonID" CommandArgument='<%#Eval("D_NAME") %>' runat="server" >
- <asp:Image ID="Image1" runat="server" Height="300px" Width="250px" ImageUrl='<%#Eval("D_IMAGE") %>'/>
- </asp:LinkButton>
-
- </div>
- </li>
-
- </ul>
- </ItemTemplate>
- </asp:DataList></>
- </div>
and this is a pic of what .aspx page when viewed on browser
these are two tables which are joined in order to show the user only the "Duas" that he inserted in Selected_List table.
currently these are sequenced according to the DNO in DUAS table(Ascending Order)
Now as you can see what i am doing is displaying the Data only after joining so the user can see only his own data.
now somehow i need to perform sorting which is working with the above javascript function but i can't store this change in the database so that user sees the change next time which he made
i need some function which saves sorting position in database as soon as i drag replace two pics position