<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. 电脑自动访问g.ceipmsn.com

    电脑老师每隔1分3秒自动访问 g.ceipmsn.com这个域名 经过排查发现是TeamViewer8在作怪,好像是一直在激活引起的 关闭TeamViewer程序就好了.

  2. POJ 3694 tarjan 桥+lca

    Network Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 7298   Accepted: 2651 Descripti ...

  3. HTML5 的data-* 自定义属性

    HTML5增加了一项新功能是自定义数据属性,也就是 data-*自定义属性. 在HTML5中我们可以使用以data-为前缀来设置我们需要的自定义属性,来进行一些数据的存放. 当然高级浏览器下可通过脚本 ...

  4. jboss入门学习1

    环境准备 win8 jdk1.6 jboss4.0.5 oracle10g 修改jboss默认端口 server/default/conf/jboss-service.xml 1.WebService ...

  5. CSS第四天总结 更多的属性 圆角 边框图片 段落属性 颜色渐变 盒子阴影

    圆角边框: border-radius    一个值时表示四个角用的圆半径,4个值时分别是左上角.右上角.左下角.右下角,单位可以是px和百分比,百分比是半径相对于边框长度的比例 在CSS3中我们终于 ...

  6. vitruviano

    维特鲁威人(意大利语:Uomo vitruviano) 是列奥纳多·达·芬奇在1487年前后创作的世界著名素描. 它是钢笔和墨水绘制的手稿,规格为34.4 cm × 25.5 cm. 根据约1500年 ...

  7. 简介C#读取XML的两种方式

    简介C#读取XML的两种方式 作者: 字体:[增加 减小] 类型:转载 时间:2013-03-03 在程序中访问进而操作XML文件一般有两种模型,分别是使用DOM(文档对象模型)和流模型,使用DOM的 ...

  8. Javascript DOM基础(一)概念

    Dom基础概念: <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" ...

  9. html元素中id和name的区别

    可以说几乎每个做过Web开发的人都问过,到底元素的ID和Name有什么区别阿?为什么有了ID还要有Name呢?! 而同样我们也可以得到最classical的答案:ID就像是一个人的身份证号码,而Nam ...

  10. 用meta-data配置参数

    在接入第三方渠道SDK的时候,经常会看到其配置文件AndroidManifest.xml有类似如下的定义: <!-- appid --> <meta-data android:nam ...