我在我的UI中使用了重新排序列表。我的重新排序列表是和SQLDataSource如下所示。我收到一条错误消息
“重新排序失败,请参阅下面的详细信息。\ r \ n \ r \ n无法重新排序。”
似乎微不足道,但无法找到问题。你能帮我解决这个问题吗?
消息代码 '/>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString='<%$ ConnectionStrings:ConnectionString %>'
SelectCommand="SELECT * FROM TBL_BATCH_STAGE WHERE RQUST_KEY=@RequestId ORDER BY [ORDER_NO] ASC"
UpdateCommand="UPDATE [TBL_BATCH_STAGE] SET [ORDER]=@Order WHERE [BATCH_STG_KEY] = @original_ID"
OldValuesParameterFormatString="original_{0}">
<SelectParameters>
<asp:SessionParameter Name="RequestId" SessionField="RequestId" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="Order" Type="Int32" />
<asp:Parameter Name="original_ID" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
答案 0 :(得分:0)
解决了这个问题。我的SQL参数与我的ReorderList变量名称不匹配。
<asp:SqlDataSource ID="SqlDataSource1" OldValuesParameterFormatString="original_{0}" runat="server" ConnectionString='<%$ ConnectionStrings:ConnectionString %>'
SelectCommand="SELECT * FROM TBL_BATCH_STAGE WHERE RQUST_KEY=@RequestId ORDER BY [ORDER_NO] ASC"
UpdateCommand="UPDATE [TBL_BATCH_STAGE] SET [ORDER_NO]=@ORDER_NO WHERE [BATCH_STG_KEY] = @original_BATCH_STG_KEY" >
<SelectParameters>
<asp:SessionParameter Name="RequestId" SessionField="RequestId" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="ORDER_NO" Type="Int32" />
<asp:Parameter Name="original_BATCH_STG_KEY" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
<asp:ReorderList ID="ReorderList1" runat="server" AllowReorder="true" DataKeyField="BATCH_STG_KEY" DataSourceID="SqlDataSource1" SortOrderField="ORDER_NO">
<ItemTemplate>
<table style="border:solid 1px #cccccc;">
<tr>
<td style="vertical-align:top;list-style:none;font-size:13px;padding:0 0 0 0;">
<asp:Label ID="ItemLabel" runat="server" Text='<%# Eval("BATCH_STG_TEXT")%>' />
</td>
</tr>
</table>
</ItemTemplate>
</asp:ReorderList>