Ticket Q200215
Visible to All Users

How can I get the grid to sort my ObjectDataSource on the server?

created 16 years ago

Hi,
I'm trying to get sorting to work. I have my own ObjectDataSource that has its own sorting mechanism. What I need from the grid with each page render is what column the user is sorting by, and which direction. With that information, I can update my data source to get the right records in the right order.
A little more info…
My data source is SQL driven, so I'm trying to build an ORDER BY clause. Materializing the entire database table isn't practical.
Please let me know how I should go about doing this. I've read in other posts that putting the control in server mode might help, but I still don't see where in your grid API I'm supposed to hook in to sort the records. BTW - I had trouble getting sorting working with MS's GridView using the Sorting event; it would always sort after two clicks, and then only in ascending order.
Thanks in advance,
-Mike
P.S. Please do *not* direct me to the "Sort the grid at database level!" posting. I read that and it did not help me at all.

Comments (1)
DevExpress Support Team 16 years ago

    Hi Mike,
    Since you're working with an ObjectDataSource, you can enable the DataSourceForceStandardPaging option in order to force the ASPxGridView to perform paging and sorting on the server. For more information, please refer to the following help topic:
    ASPxGridView.DataSourceForceStandardPaging Property
    Also, please look at the following bug report, where you can find a sample, illustrating this approach in action:
    ID: B96899, An incorrect sort expression is generated by the grid, if the DataSourceForceStandardPaging property is set to true to perform custom server-side sorting
    Hopefully, these suggestions will be of some help. Please keep us informed about your progress.
    Thanks,
    Vito

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.