재우니의 블로그



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

 <head>

  <title> New Document </title>

  <meta name="Generator" content="EditPlus">

  <meta name="Author" content="">

  <meta name="Keywords" content="">

  <meta name="Description" content="">

  <style>

  .WDD ul

{

    cursor: move;

    display: block;

    margin-top: 5px;

}


.WDD ul li

{

    background-color: #F4F4F4;

    border: 3px solid #E7E7E7;

    margin-top: 2px;

    padding: 3px;

    display: block;

    width: 159px;

}

  </style>


    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>


  <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js" type="text/javascript"></script>



<script type="text/javascript">

        


        $(document).ready(function() {

            


            $("#ulWidgets").sortable();

            $("#btnSaveSort").click(function() {


                var items = $("#ulWidgets li");

                var sended = "";

                for (var i = 0; i < items.length; i++) {

                    sended += items[i].id;

                    sended += "|";

                }


                alert(sended);

            });

        });

    </script>



 </head>


 <body>




<div class="WDD">

<ul id="ulWidgets">

<li id='1'>aaaaaaa</li>

<li id='2'>bbbbbb</li>

<li id='3'>cccccc</li>

<li id='4'>ddddddd</li>

<li id='5'>eeee</li>

<li id='6'>ffffff</li>

<li id='7'>gggggg</li>

<li id='8'>hhhhhhh</li>

<li id='9'>iiiiiiiiii</li>

</ul>

<br />

<a href="#" id="btnSaveSort" class="bsbutton green block"><span>

Save</span></a>

</div>



 </body>

</html>




string[] List = SortList.Split('|');

      Hashtable hT = new Hashtable();

      string Command = "";

      for (int i = 0; i < List.Length - 1; i++) {

        Command = "UPDATE Widgets Set [Sort] = " + (i + 1) + " Where WidgetID = " + List[i];

        DBToys.Do.ExecuteSQL(Command);

      }