This is a migrated thread and some comments may be shown as answers.

[Solved] Getting sortcolumn and order in NeedDataSource

1 Answer 104 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mattias
Top achievements
Rank 1
Mattias asked on 10 Apr 2008, 02:20 PM
Hi,
How can I get the current sortcolumn and sortorder in the event NeedDataSource?
        [code]protected void RadGrid1_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            skip = RadGrid1.CurrentPageIndex * RadGrid1.PageSize;
            take = RadGrid1.PageSize;
            string sortColumn = "";
            bool sortOrder = true; //false
            RadGrid1.DataSource = GetData(sortColumn, sortOrder, skip, take);
        }[/code]

Thanks,
Mattias

1 Answer, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 11 Apr 2008, 07:55 AM
Hello Mattias,

You can use the sort expressions:

RadGrid1.MasterTableView.SortExpressions[0].FieldName
RadGrid1.MasterTableView.SortExpressions[0].SortOrder

You can find more information about sorting in RadGrid in Sorting chapter in RadGrid online help.

Sincerely yours,
Ves
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Mattias
Top achievements
Rank 1
Answers by
Ves
Telerik team
Share this question
or