码迷,mamicode.com
首页 > 其他好文 > 详细

reorderList使用

时间:2014-12-15 18:39:37      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:des   style   http   io   ar   os   使用   sp   for   

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

 

 <form id="form1" runat="server">
<ajaxToolkit:ToolkitScriptManager ID="asm" runat="server">
    </ajaxToolkit:ToolkitScriptManager>

    <div>

 
 
       <asp:UpdatePanel ID="up1" runat="server">
            <ContentTemplate>

  <ajaxToolkit:ReorderList
   ID="rl1"
  runat="server"
  SortOrderField="position"
        AllowReorder="true"
         DataSourceID="sds"
         DataKeyField="id" onitemreorder="rl1_ItemReorder"   > 
             <DragHandleTemplate> 
                      <div class="DragHandleClass">   
                             </div>   
                               </DragHandleTemplate>   
                                 <ItemTemplate> 
     <asp:Label ID="ItemLabel" runat="server" Text=‘<%#Eval("description") %>‘ />  
     </ItemTemplate>

             <ReorderTemplate>
                            <asp:Panel ID="Panel2" runat="server" CssClass="reorderCue" />
                        </ReorderTemplate>

     </ajaxToolkit:ReorderList>


       <asp:SqlDataSource
       ID="sds"
       runat="server"
       ConnectionString="Data Source=.;Initial Catalog=MyRoleTest;Integrated Security=True" 
           ProviderName="System.Data.SqlClient"
           OldValuesParameterFormatString="original_{0}"   
             SelectCommand="SELECT [id], [char], [description], [position] FROM [AJAX] ORDER BY [position]"    
              UpdateCommand="UPDATE [AJAX] SET position=@position WHERE [id]=@original_id">   
                <UpdateParameters>      
                    <asp:Parameter Name="position" Type="Int32" />  
                            <asp:Parameter Name="original_id" Type="Int32" />    
                </UpdateParameters>
        </asp:SqlDataSource>


     </ContentTemplate>
     </asp:UpdatePanel>


<%--
   <div class="demoarea">
        <div class="demoheading">ReorderList Demonstration</div>
        <i>To Do:</i>
        <asp:UpdatePanel ID="up1" runat="server">
            <ContentTemplate>
                <div class="reorderListDemo">
                    <ajaxToolkit:ReorderList ID="ReorderList1" runat="server"
                        PostBackOnReorder="false"
                        DataSourceID="ObjectDataSource1"
                        CallbackCssStyle="callbackStyle"
                        DragHandleAlignment="Left"
                        ItemInsertLocation="Beginning"
                        DataKeyField="ItemID"
                        SortOrderField="Priority">
                        <ItemTemplate>
                            <div class="itemArea">
                                <asp:Label ID="Label1" runat="server"
                                    Text=‘<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("Title"))) %>‘ />
                                <asp:Label ID="Label2" runat="server"
                                    Text=‘<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("Description", " - {0}"))) %>‘ />
                            </div>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <div class="itemArea">
                                <asp:TextBox ID="TextBox2" runat="server" Text=‘<%# Bind("Title") %>‘ ValidationGroup="edit" />
                                <asp:TextBox ID="TextBox3" runat="server" Text=‘<%# Bind("Description") %>‘ ValidationGroup="edit" />
                                <asp:TextBox ID="TextBox4" runat="server" Text=‘<%# Bind("Priority") %>‘ ValidationGroup="edit" />
                            </div>
                        </EditItemTemplate>
                        <ReorderTemplate>
                            <asp:Panel ID="Panel2" runat="server" CssClass="reorderCue" />
                        </ReorderTemplate>
                        <DragHandleTemplate>
                            <div class="dragHandle"></div>
                        </DragHandleTemplate>
                        <InsertItemTemplate>
                            <!-- bottom border is workaround for IE7 Beta issue where bg doesn‘t render -->
                            <div style="padding-left:25px; border-bottom:thin solid transparent;">
                                <asp:Panel ID="panel1" runat="server" DefaultButton="Button1">
                                    <asp:TextBox ID="TextBox1" runat="server" Text=‘<%# Bind("Title") %>‘ ValidationGroup="add" />
                                    <asp:Button ID="Button1" runat="server" CommandName="Insert" Text="Add"  ValidationGroup="add" />
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ValidationGroup="add"
                                        ErrorMessage="Please enter some text" ControlToValidate="TextBox1" />
                                </asp:Panel>
                            </div>
                        </InsertItemTemplate>
                    </ajaxToolkit:ReorderList>
                </div>
   
                <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="Delete"
                    InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="Select"
                    TypeName="SessionTodoXmlDataObject" UpdateMethod="Update">
                    <DeleteParameters>
                        <asp:Parameter Name="Original_ItemID" Type="Int32" />
                    </DeleteParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="Title" Type="String" />
                        <asp:Parameter Name="Description" Type="String" />
                        <asp:Parameter Name="Priority" Type="Int32" />
                        <asp:Parameter Name="Original_ItemID" Type="Int32" />
                    </UpdateParameters>
                    <InsertParameters>
                        <asp:Parameter Name="Title" Type="String" />
                        <asp:Parameter Name="Description" Type="String" />
                        <asp:Parameter Name="Priority" Type="Int32" />
                    </InsertParameters>
                </asp:ObjectDataSource>   
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>

--%>

    </div>
    </form>

 

reorderList使用

标签:des   style   http   io   ar   os   使用   sp   for   

原文地址:http://www.cnblogs.com/movemoon/p/4165371.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!