How to save the sequence in the database after dragging dropping

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
  1. <script >
  2.         (function () {
  3.             var droppableParent;

  4.             $('ul .element').draggable({
  5.                 revert: 'invalid',
  6.                 revertDuration: 200,
  7.                 start: function () {
  8.                     droppableParent = $(this).parent();

  9.                     $(this).addClass('being-dragged');
  10.                 },
  11.                 stop: function () {
  12.                     $(this).removeClass('being-dragged');
  13.                 }
  14.             });

  15.             $('ul li').droppable({
  16.                 hoverClass: 'drop-hover',
  17.                 drop: function (event, ui) {
  18.                     var draggable = $(ui.draggable[0]),
  19.                         draggableOffset = draggable.offset(),
  20.                         container = $(event.target),
  21.                         containerOffset = container.offset();

  22.                     $('.element', event.target).appendTo(droppableParent).css({ opacity: 0 }).animate({ opacity: 1 }, 200);

  23.                     draggable.appendTo(container).css({ left: draggableOffset.left - containerOffset.left, top: draggableOffset.top - containerOffset.top }).animate({ left: 0, top: 0 }, 200);
  24.                 }
  25.             });
  26.         }());


  27.       </script>
this is the code in .aspx page
  1. <div >
  2.            <asp:DataList   ID="DataList1" runat="server" RepeatColumns="5" CellPadding="4" CellSpacing="10" AllowSorting="True"  OnItemCommand="DataList1_ItemCommand">
  3.             <ItemTemplate>
  4.                <%-- <table width="90%" >
  5.                     <ul>
  6.                     <tr>
  7.                         <td>

  8.                          <li >
  9.                              <div class="element">
  10.                              <asp:ImageButton CssClass="element" ID="ImageButton1" CommandArgument='<%#Eval("D_NAME") %>' runat="server" Height="300px" Width="250px" ImageUrl='<%#Eval("D_IMAGE") %>'  />

  11.                           <br /></td>  
  12.                         </div>
  13.                          </li>
  14.                                     
  15.                         <td><br /></td>
  16.                     </tr>
  17.                     <ul>
  18.                 </table>--%>
  19.                  <ul>
  20.     <li>
  21.         <div class="element">
  22.     <asp:LinkButton ID="LinkButtonID"  CommandArgument='<%#Eval("D_NAME") %>' runat="server" >
  23.             <asp:Image ID="Image1" runat="server" Height="300px" Width="250px" ImageUrl='<%#Eval("D_IMAGE") %>'/>

  24.     </asp:LinkButton>
  25.         

  26.         </div>
  27.     </li>
  28.                      
  29.                      </ul>

  30.             </ItemTemplate>
  31.             </asp:DataList></>
  32.         </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