zoukankan      html  css  js  c++  java
  • ReorderList 的使用

      <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="30px; height:25px; cursor:move" />
                    </DragHandleTemplate>
                    <ReorderTemplate>
                      <div style="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();
            }

  • 相关阅读:
    设计和实现OLAP解决方案
    数据库的数据挖掘概述
    SharePoint 2007中的搜索服务 Virus
    分离SharePoint的应用服务器的过程中遇到的问题 Virus
    自定义对象的比较系列二之实现IComparable Virus
    软件行业和传统行业的比较 Virus
    Sharepoint中用treeview来显示组织机构的人员状态的webpart Virus
    自定义对象的比较系列一之实现IComparable Virus
    无法保存webpart的属性设置,发生意外,异常来自 HRESULT:0x80020009(DISP_E_EXCEPTION) Virus
    SPD开发工作流需要注意的地方3[SPD工作流访问隐藏栏] Virus
  • 原文地址:https://www.cnblogs.com/movemoon/p/4167542.html
Copyright © 2011-2022 走看看