2012-01-25 26 views
0

似乎有很多人在使用這一控件工具包時遇到問題。我在網上尋找了幾天的答案,一直沒能找到答案。我目前看到的最佳解決方案是「編寫你自己的重新排序程序」,我不想這樣做。AjaxControlToolkit - ReorderList - 不執行更新聲明

<asp:ScriptManager ID="smgrJobBidding" runat="server"> 
    </asp:ScriptManager> 
<asp:UpdatePanel ID="uPanelReorderList" runat="server" 
    EnableViewState="False" ViewStateMode="Disabled"> 
    <ContentTemplate> 
<ajaxToolkit:ReorderList ID="rlBiddingJobs" runat="server" AllowReorder="True" 
    DataKeyField="BidID" 
    DataSourceID="sqlDStblJobBids" 
    PostBackOnReorder="True" 
    SortOrderField="Preference" 
    DragHandleAlignment="Left" 
    ClientIDMode="AutoID" 
    EnableViewState="False"> 
    <DragHandleTemplate> 
     <div style="float:left;" class="DragHandleClass"> 
     </div> 
    </DragHandleTemplate> 
    <ItemTemplate> 
     <asp:Button ID="btnDeleteSignup" runat="server" CommandName="Delete" 
     style="float:right;" Text="Delete" Width="75" Font-Size="Small" Height="20px" /> 
     <asp:Label ID="lblPostingID" runat="server" Text='<%# Eval("PostingID") %>'></asp:Label> 
    </ItemTemplate> 
</ajaxToolkit:ReorderList> 
    </ContentTemplate> 
</asp:UpdatePanel> 

由於表的標準化佈局,SQL數據源對象有點笨重。

<asp:SqlDataSource ID="sqlDStblJobBids" runat="server" 
    ConnectionString="<%$ ConnectionStrings:JobsDB %>" 
    SelectCommand="SELECT dbo.tblJobBids.BidID, dbo.tblJobBids.PostingID, dbo.tblJobBids.EUID, dbo.tblJobBids.Preference, dbo.tblJobPostings.Shift, dbo.tblJobPostings.Needs, 
        dbo.tblJobPostings.PostedDate, dbo.tblJobPostings.ClosingDate, dbo.tblDepartments.Department, dbo.tblJobs.JobName 
FROM dbo.tblJobBids INNER JOIN 
        dbo.tblJobPostings ON dbo.tblJobBids.PostingID = dbo.tblJobPostings.PostingID  INNER JOIN 
        dbo.tblJobs ON dbo.tblJobPostings.JobID = dbo.tblJobs.JobID INNER JOIN 
        dbo.tblDepartments ON dbo.tblJobPostings.DepartmentID = dbo.tblDepartments.DeptID 
WHERE tblJobPostings.ClosingDate &gt;= (SELECT GETDATE()) AND tblJobPostings.PostingID 
IN (SELECT tblJobBids.PostingID FROM tblJobBids WHERE tblJobBids.EUID = @EUID) 
ORDER BY tblJobBids.Preference Asc;" 
    DeleteCommand="DELETE FROM tblJobBids WHERE tblJobBids.BidID = @BidID;" 
    UpdateCommand="UPDATE dbo.tblJobBids SET tblJobs.Preference = @Preference WHERE tblJobs.BidID = @BidID;" > 
    <DeleteParameters> 
     <asp:Parameter Name="BidID" /> 
    </DeleteParameters> 
    <SelectParameters> 
     <asp:SessionParameter Name="EUID" SessionField="sEUID" /> 
    </SelectParameters> 
    <UpdateParameters> 
     <asp:Parameter Name="Preference" Type="Byte"/> 
     <asp:Parameter Name="BidID" Type="Int32"/> 
    </UpdateParameters> 
</asp:SqlDataSource> 

Select語句是好的,我可以拖動該項目所有我想要的,但他們「橡皮筋」回他們在拖動前的位置。這就像更新聲明不回發。

我已經添加了一些故障排除代碼來計算更新面板內的異步回發,它絕對回傳。數據庫中的數據(SQL Server 2008 R2 Express)似乎沒有發生變化。它可能會改變,然後改回來...我在看日誌。

看到有什麼明顯的錯誤?

+0

從updatepanel中刪除viewstate選項,您的redorderlist在每次回發時重新綁定。 –

+0

它有EnableViewState =「False」ViewStateMode =「已禁用」,是不是你的意思?我已經嘗試過兩種方法。 – Lucretius

回答

0

結果我很笨,我在SQL Server 2008中將SortOrderField的數據類型設置爲「tinyint」。我將其從「int」更改爲「int」,現在它正在工作。我最初創建它爲「tinyint」,因爲偏好通常只會以1-10這樣的小規模進行。無論如何,它現在工作。