RadGrid cannot pass sortExpression to ObjectDataSourceControl

Posted by Jeff on Stack Overflow See other posts from Stack Overflow or by Jeff
Published on 2010-02-10T17:44:23Z Indexed on 2010/04/27 3:03 UTC
Read the original article Hit count: 547

Filed under:

I have a Telerik RadGrid that bound to a datasource object. They are configured to support custom paging, sorting. For paging, only the data of a page is retrieved from the database. Before sorting, it works fine. The select method of the datasource is like

public List<xxx> Select(string sortExpression, int maximumRows, int startRowIndex)
{}

Before sorting the sortExpression is empty, which is expected. But after use click sort, in the OnSortCommand event handler of Radgrid, the SortExpression is correct, indicating RadGrid has caputre user's sorting correctly.

protected void OnSort(object source, GridSortCommandEventArgs e)
{
        Console.WriteLine(e.SortExpression); // correct
}

But what is strange is that the RadGrid does not pass parameter to DataSource correctly this time. sortExpression is still empty, maximumRows became int.Max, and startRowIndex is 0. The the sorting in still render correctly, but grid ask datasource to get all data and do the sorting locally.

Is this bug of RadGrid or my configuration is wrong?

© Stack Overflow or respective owner

Related posts about radgrid