Asp.net AjaxControlToolkit-ReorderList-不执行Update语句
似乎很多人在使用这个控件工具包时遇到了麻烦。我在互联网上找了几天的答案,但都没找到。到目前为止,我看到的最好的解决方案是编写自己的重新排序过程,我不想这样做Asp.net AjaxControlToolkit-ReorderList-不执行Update语句,asp.net,vb.net,sql-server-2008,tsql,ajaxcontroltoolkit,Asp.net,Vb.net,Sql Server 2008,Tsql,Ajaxcontroltoolkit,似乎很多人在使用这个控件工具包时遇到了麻烦。我在互联网上找了几天的答案,但都没找到。到目前为止,我看到的最好的解决方案是编写自己的重新排序过程,我不想这样做 <asp:ScriptManager ID="smgrJobBidding" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="uPanelReorderList" runat="server" EnableViewState=
<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 >= (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语句很好,我可以拖动所有我想要的项目,但它们会被橡皮筋拉回到拖动前的位置。好像update语句没有在回发时触发
我已经添加了一些故障排除代码来计算更新面板中的异步回发次数,它肯定是在回发。数据库SQL Server 2008 R2 Express中的数据似乎没有更改。它可能会改变,然后再改变回来。。。我在看日志
看到什么明显的错误了吗?原来我很笨,我在SQL Server 2008中将SortOrderField的数据类型设置为tinyint。我把它从原来的整数改成了整数,现在可以用了。我最初将其创建为tinyint,因为偏好通常只会在一个小范围内,比如1-10。不管怎样,它现在正在工作。从updatepanel中删除viewstate选项,您的redorderlist在每次回发时都会重新绑定。它的EnableViewState=False ViewStateMode=Disabled,这不是您的意思吗?实际上我已经试过两种方法了。