tags:

views:

248

answers:

1

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?

A: 

Did you set the telerikBoundColumn's SortExpression?

For example: SortExpression="companyName"

hp laptop battery