reorderlist sort descending

Posted on 2009-12-29
Last Modified: 2013-11-08

Recently I've been working on a football depth chart web application.  I've been making use of the ajaxcontroltoolkit's reorderlist control with a sqldatasource in order to handle the reordering of individual players by position, and it works well.  However, for the second half of my application I need to show the list in reverse (e.g. instead of showing 1,2,3 top to bottom I need to show 1,2,3 bottom to top).  I changed my sql statement to sort descending instead of ascending, and on the initial view the data appears as desired.  When I reorder the list the items appear to act as expected, but the reorderlist does not update the database properly.  The sort order database field (in this case called playerdepth) values climb with each successive reorder and also refuse to save in the correct order.  

So my question: is it possible to sort this list from bottom to top and successfullly reorder it through the use of the reorderlist control?  I can post some code if need be, but it's a pretty simple implementation.     Any help is greatly appreciated.
The data source, which renders correctly:

                        <asp:SqlDataSource ID="dsPos1" runat="server" 

                            ConnectionString="<%$ ConnectionStrings:DataCon %>" 

                            SelectCommand="SELECT PlayerDepth, PlayerID, LastName, PositionAbbr, JerseyNumber, Height,Weight,DepthID, Speed, CAST(ISNULL(EntryYear, '-') AS nvarchar(4)) + '/' + CAST(ISNULL(DraftRound, '-') AS nvarchar(2)) AS DraftInfo FROM DepthChartPlayersTemp WHERE (CurrentClub = @CurrentClub) AND (PositionID = @Position) ORDER BY PlayerDepth desc" 

                  UpdateCommand="Update DepthChartPlayersTemp Set PlayerDepth = @PlayerDepth where DepthID = @DepthID">


                                <asp:Parameter Name="CurrentClub" />

                                <asp:Parameter Name="Position" />



                                <asp:Parameter Name="PlayerDepth" />

                                <asp:Parameter Name="DepthID" />



And the reorderlist: 

cc1:ReorderList ID="rePos1" runat="server" 

                            DataKeyField="DepthID" DataSourceID="dsPos1" PostBackOnReorder="False" 

                            SortOrderField="PlayerDepth" CssClass="reorderStyle" AllowReorder="True">


                                <table cellpadding="0" cellspacing="0" class="style1" 


                                    style="font-family: Calibri; border: 1px solid #000000; background-color: #FFFFFF; font-size: 8pt;" 




                                            <asp:Label ID="lblJersey" runat="server" Text='<%# Eval("JerseyNumber") %>' 



                                        <td colspan="3">

                                            <asp:Label ID="lblName" runat="server" Text='<%# Eval("LastName") %>' 






                                            <asp:Label ID="lblHeight" runat="server" Text='<%# Eval("Height") %>' 




                                            <asp:Label ID="lblWeight" runat="server" Text='<%# Eval("Weight") %>' 




                                            <asp:Label ID="lblSpeed" runat="server" Text='<%# Eval("Speed") %>' Width="25%"></asp:Label>



                                            <asp:Label ID="lblDraft" runat="server" Text='<%# Eval("DraftInfo") %>' 







Open in new window

Question by:sdh68
    1 Comment
    LVL 96

    Accepted Solution

    I don't see a way.  If you have the source code for the AJAX control toolkit 3.0, you can see that there is an internal method (ReorderList.DoReorderInternal), that performs the sorting.  It looks like it only handles ascending sorts.

    private bool DoReorderInternal(IEnumerable dataSource, int oldIndex, int newIndex, DataSourceView dsv)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (…
    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    794 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now