Update reorderList with sqlDataSource

Is it possible to update the reorderList (and the database) with the UpdateCommand in sqlDataSource?

I tried something I found on the internet:
"UPDATE Categories SET [Order] = @Order WHERE CategoryID = @original_CategoryID"

(Link to website is only cached by Google, and the code is therefore inserted at the bottom of this text.)

This seems wrong (and doesn't work) since it only takes the "Order" parameter from the item you are moving and setting it to the same value it was before moving it.

Do you know some way to use sqlDataSource to update the reorderList and database's order?

Example code:
// Connection String
    <add name="ConnectionString" connectionString

 <cc1:ReorderList CssClass="ReOrderControlStyle"
 OnItemReorder="ReOrderItemEvent" SortOrderField="Order" AllowReorder="true"

             ItemInsertLocation="Beginning" DragHandleAlignment="left"
             DataSourceID="SqlDataSource1" ID="ReorderList1" runat="server">
            <asp:Label ID="lblCategoryName" runat="server"
            Text='<%# Eval("CategoryName") %>' />

 <asp:SqlDataSource ConnectionString
 ='<%$ ConnectionStrings:ConnectionString %>' ID="SqlDataSource1"
       SelectCommand="SELECT * FROM Categories ORDER BY [Order] ASC"
        UpdateCommand="UPDATE Categories SET [Order] =
        @Order WHERE CategoryID = @original_CategoryID"
         OldValuesParameterFormatString = "original_{0}">      
      <asp:Parameter Name="Order" Type="Int32" />
      <asp:Parameter Name="original_CategoryID" Type="Int32" />
Who is Participating?
Tommie Nathaniel Carter, Jr., MBAFounderCommented:
The correct way to do an upgrade would be with the Datagrid Update Command or an update command from whatever you are binding the data to.

Please (re-) read the 4guys article it will help

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.