<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
        </asp:ToolkitScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:ReorderList ID="ReorderList1" runat="server"
                onitemreorder="ReorderList1_ItemReorder">
                <DragHandleTemplate>
                 <div style="width:30px; height:25px; cursor:move" />
                </DragHandleTemplate>
                <ReorderTemplate>
                  <div style="width:100%; height:25px; border:dashed thin black;" />
                </ReorderTemplate>
                <ItemTemplate>
                  <asp:Label ID="ItemLabel" runat="server" Text='<%#Eval("description") %>' />  
                </ItemTemplate>
            </asp:ReorderList>
        </ContentTemplate>
       
        </asp:UpdatePanel>

protected void ReorderList1_ItemReorder(object sender, AjaxControlToolkit.ReorderListItemReorderEventArgs e)
        {
            string strCnn = "Server=10.16.33.20;Database=MyRoleTest;User ID=sa;Password=123456;Pooling=true; MAX Pool Size=512;Min Pool Size=5;Connection Lifetime=30 ";

SqlConnection conn = new SqlConnection(strCnn);

//string sql = "update ajax set position='" + e.NewIndex + "'  where position='" + e.OldIndex + "'";
            string sql = "";

sql = " update AJAX set position=-999 where position=" + e.OldIndex +";";
                if (e.NewIndex > e.OldIndex)
                {
                    sql = sql + "  update AJAX set position=position-1 where position>" + e.OldIndex + " and position<=" + e.NewIndex + "; ";
                }
                else if (e.NewIndex < e.OldIndex)
                {
                    sql = sql + "  update AJAX set position=position+1 where position>=" + e.NewIndex + " and position<" + e.OldIndex + "; ";
                }
                //sql = sql + " update AJAX set position=" + e.NewIndex + " where position=" + e.OldIndex + " ;";
                sql = sql + " update AJAX set position=" + e.NewIndex + " where position=-999 ;";

SqlCommand cmd = new SqlCommand(sql, conn);
            conn.Open();

cmd.ExecuteNonQuery();

cmd.Dispose();
            conn.Dispose();

//NewMethod();
        }

ReorderList 的使用的更多相关文章

  1. Leetcode ReorderList

    Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do thi ...

  2. reorderList使用

    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" /> ...

  3. leetcode — reorder-list

    /** * Source : https://oj.leetcode.com/problems/reorder-list/ * * Given a singly linked list L: L0→L ...

  4. reorder-list 单链表

    题意: 给你一个单链表 a1 a2 a3 a4 a5....an 让你变成 a1 an a2 an-1 a3 an-2 .... 这里牵涉到,单链表的倒置和两个单链表的合并. class Soluti ...

  5. reorder-list——链表、快慢指针、逆转链表、链表合并

    Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do thi ...

  6. reorder-list leetcode C++

    Given a singly linked list L: L 0→L 1→-→L n-1→L n, reorder it to: L 0→L n →L 1→L n-1→L 2→L n-2→- You ...

  7. [LeetCode] Reorder List 链表重排序

    Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do th ...

  8. leetcode算法分类

    利用堆栈:http://oj.leetcode.com/problems/evaluate-reverse-polish-notation/http://oj.leetcode.com/problem ...

  9. BUG-FREE-For Dream

    一直直到bug-free.不能错任何一点. 思路不清晰:刷两天. 做错了,刷一天. 直到bug-free.高亮,标红. 185,OA(YAMAXUN)--- (1) findFirstDuplicat ...

随机推荐

  1. HTML 图像<img>

    定义和用法: img元素向网页中嵌入一副图像. 请注意:从技术上讲,<img>标签并不会在网页中插入图像,而是从网页上链接图像.<img>标签创建的是被引用图像的占位空间. 属 ...

  2. IE6 一些兼容性问题及处理方法

    1.IE6怪异解析之padding与border算入宽高 原因:未加文档声明造成非盒模型解析 解决方法:加入文档声明<!doctype html> 2.IE6在块元素.左右浮动.设定mar ...

  3. python 语法常用 lambda

    Python中lambda表达式学习 http://blog.csdn.net/imzoer/article/details/8667176

  4. 谈谈eclipse使用技巧二

    上节说道了怎么使用eclipse使您事半功倍.这节告诉您怎么用eclipse练成火眼金睛. ①借你一双火眼金睛让类的层次结构一目了然让你阅读代码如虎添翼 一个好的类的层次结构,让你的类的层次清晰明了, ...

  5. Mytophome Deal

    using AnfleCrawler.Common; using System; using System.Collections.Generic; using System.Linq; using ...

  6. javaweb--struts框架--struts.xml

    <?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE struts PUBLIC "-/ ...

  7. 【LeetCode OJ】Balanced Binary Tree

    Problem Link: http://oj.leetcode.com/problems/balanced-binary-tree/ We use a recursive auxilar funct ...

  8. Windows 2012 装 Remote Desktop Organizer 无法连接到其他远程服务器

    一句话,版本太低 换Remote Desktop Organizer 1.4.5版本就ok 了

  9. linux下实时监测tomcat关闭并启动

    linux下tomcat总是会无故出现自动关闭的情况,在暂时无法解决该问题时,就需要一个东西能实时监测tomcat是否还正常的运行,若发现已关闭时,执行启动命令. 我们可以添加一个shell脚本来实现 ...

  10. IOS网络开发(二)

    1 局域网群聊软件 1.1 问题 UDP协议将独立的数据包从一台计算机传输到另外一台计算机,但是并不保证接受方能够接收到该数据包,也不保证接收方所接收到的数据和发送方所发送的数据在内容和顺序上是完全一 ...