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

Sorting Problem

1 Answer 43 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 17 Feb 2009, 11:32 AM
Hi,

We are running with Q2 2008 edition at present and I am experiencing a sorting issue. I am binding to a List<T> which contains a date field that I want to sort in a descending direction. The sort actually works fine and the most recent dates are at the top of the grid. My problem however is that the current row remains at the bottom of the grid e.g. on the row containing the oldest date and that results in my grid when rendered being scrolled all the way to the bottom. Does anybody have any answers? Is this something that was an issue in Q2 2008?

Regards,
Mark

            radGridViewSpreadData.MasterGridViewTemplate.AutoGenerateColumns = false;

            radGridViewSpreadData.MasterGridViewTemplate.SortExpressions.Clear();

            radGridViewSpreadData.MasterGridViewTemplate.SortExpressions.Add(new GridSortField("Date", RadSortOrder.Descending));

            radGridViewSpreadData.DataSource = this.Spread;

1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 18 Feb 2009, 12:21 PM
Hi Mark,

When initialized, RadGridView scrolls to the currently selected row. You can change this row through setting the CurrentRow property. Take a look at the code snippet:

radGridViewSpreadData.MasterGridViewTemplate.AutoGenerateColumns = false
radGridViewSpreadData.MasterGridViewTemplate.SortExpressions.Clear(); 
radGridViewSpreadData.MasterGridViewTemplate.SortExpressions.Add(new GridSortField("Date", RadSortOrder.Descending)); 
radGridViewSpreadData.DataSource = this.Spread; 
radGridViewSpreadData.CurrentRow = this.radGridViewSpreadData.Rows[0] 

I hope this helps. Should you have any other questions, I will be glad to help you.

Best wishes,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Mark
Top achievements
Rank 1
Answers by
Jack
Telerik team
Share this question
or