2012-04-10 23 views
3

我需要使用拖拽控件來下令控制列表。我想通過AjaxControlToolkit的ReorderList控件來實現這一點。我已經嘗試過所有的工作,但它不會。一切都很順利,就像填充列表等一樣。但是我不能像使用它一樣使用這個控件。當頁面加載時,它會顯示一個列表,左邊是一個reordergrip,但是當我嘗試拖動一個項目時,它不會拖動。它只是呆在原地。我也嘗試過其他瀏覽器,如IE9 & Firefox。有人可以幫助我解決這個問題嗎?我在Visual Studio 2010中使用ASP.NET/C#。AjaxControlToolkit ReorderList不起作用

提前謝謝!

ASPX:

<asp:ScriptManager ID="ScriptManager1" runat="server"> 
    </asp:ScriptManager> 
    <asp:UpdatePanel ID="UpdatePanel1" runat="server"> 
     <ContentTemplate> 
     <div class="ajaxOrderedList"> 
      <asp:ReorderList runat="server" DataSourceID="SqlDataSource1" ID="rlData" PostBackOnReorder="true" DragHandleAlignment="Left" ItemInsertLocation="Beginning" SortOrderField="Naam" AllowReorder="true"> 
       <DragHandleTemplate> 
        <asp:Panel ID="dragHandle" runat="server" 
         style="height: 20px; width: 20px; border: solid 1px black; background-color: Red; cursor: pointer;" 
         Visible="<%# ShowDragHandle %>"> 
         &nbsp; 
        </asp:Panel> 
        </DragHandleTemplate> 
       <ItemTemplate> 
        <div class="itemArea"> 
         <asp:Label ID="lblNaam" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("Naam"))) %>' /> 
         <asp:Label ID="lblFunctie" runat="server" Text='<%# HttpUtility.HtmlEncode(Convert.ToString(Eval("Functie"))) %>' /> 
        </div> 
       </ItemTemplate> 
       <ReorderTemplate> 
        <div style="width: 300px; height: 20px; border: dotted 2px black;"> 
         &nbsp; 
        </div> 
       </ReorderTemplate> 
      </asp:ReorderList> 
      </div> 
     </ContentTemplate> 
    </asp:UpdatePanel> 
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:testdataConnectionString %>" 
    SelectCommand="SELECT [id], [naam], [functie] FROM [personen]" DeleteCommand="DELETE FROM [personen] WHERE [id] = @intID" 
       InsertCommand="INSERT INTO [personen] ([naam], [functie]) VALUES (@strNaam, @strFunctie)" 
       UpdateCommand="UPDATE [personen] SET [naam] = @strNaam, [functie] = @strFunctie WHERE [id] = @intID"> 
       <DeleteParameters> 
       <asp:Parameter Name="intID" Type="Int32" /> 
      </DeleteParameters> 
      <UpdateParameters> 
       <asp:Parameter Name="strNaam" Type="String" /> 
       <asp:Parameter Name="srtFunctie" Type="String" /> 
       <asp:Parameter Name="intID" Type="Int32" /> 
      </UpdateParameters> 
      <InsertParameters> 
       <asp:Parameter Name="strNaam" Type="String" /> 
       <asp:Parameter Name="srtFunctie" Type="String" /> 
      </InsertParameters> 
</asp:SqlDataSource> 

代碼背後:不工作Reorderlist的

DataView MyDView = null; 

     protected void Page_Load(object sender, EventArgs e) 
     { 
      if (!IsPostBack) 
      { 
       ShowDragHandle = true; 
      } 
     } 

     protected void ReorderList1_ItemReorder(object sender, ReorderListItemReorderEventArgs e) 
     { 
      ShowDragHandle = true; 
     } 

     protected Boolean ShowDragHandle { get; set; } 


     protected void Page_PreInit(object sender, EventArgs e) 
     { 
      //set theme 
      this.Theme = "ServiceSuite"; 
     } 

圖片(這是我所得到的,如果我嘗試拖動一個項目!):

This is what I get if I try to drag an item!

+0

[這裏](http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/ReorderList/ReorderList.aspx)這是我所需要的! – 2012-04-10 08:49:25

+0

也有同樣的問題。得到這個 – sandeep 2013-01-30 05:12:52

回答

4

嘗試添加以下內容到reorderlist性能

ClientIDMode="AutoID" 
+1

哇這樣一個簡單的修復,但完美的任何解決方案! – Eliseo 2016-08-22 13:05:14

0

使用老版本的AjaxContro時,看到同樣的問題lToolkit。它似乎在當前版本(2012年9月)中得到修復,當然我不能在我的項目中使用這個版本。但也許更新會幫助其他人。

相關問題