[Last Call] Learn how to a build a cloud-first strategyRegister Now


Update reorderList with sqlDataSource

Posted on 2007-08-03
Medium Priority
Last Modified: 2012-08-13
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" />
Question by:wahooo
1 Comment

Accepted Solution

Tommie Nathaniel Carter, Jr., MBA earned 2000 total points
ID: 19627605
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


Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question