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

Automatically sort with drag and drop.

3 Answers 106 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Thomas Van den Bossche
Top achievements
Rank 1
Thomas Van den Bossche asked on 20 Oct 2009, 08:12 AM
Dear,

I implemented some drag&drop functionality with two GridViews.
Now when I drag one row to the other GridView, it should automatically sort the GridView based on a default column.

I've added a sort expression programmatically at the beginning of my program:
gridAssigned.MasterGridViewTemplate.SortExpressions.Add( "Order" ); 

Inserting a row (drag&drop):
object[] values = new object[ 10 ]; 
[...] 
gridAssigned.Rows.Add( values ); 

Is there some extra code needed in an event when adding this row? Because now it's added at the bottom of the GridView.
Thanks in advance!





3 Answers, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 22 Oct 2009, 11:21 AM
Hi Thomas Van den Bossche,

For some reason, your sort expression is not applied correctly when you add a new row. We will make more fixes for this scenarios and the new fixed behavior will be introduced in our next release. In the current situation, you can call the Update method of GridViewTemplate:

object[] values = new object[ 10 ];
[...]
gridAssigned.Rows.Add( values );
gridAssigned.MasterGridViewTemplate.Update(GridUINotifyAction.RowsChanged);

Do not hesitate to write me back if you have further questions.

All the best,
Julian Benkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Thomas Van den Bossche
Top achievements
Rank 1
answered on 04 Nov 2009, 08:19 AM
I've tried this but the grid doesn't sort...
Is this because I've added the rows manually and didn't use a DataSource?
0
Julian Benkov
Telerik team
answered on 06 Nov 2009, 08:18 AM
Hello Thomas Van den Bossche,

RadGridView can be sorted in bound and unbound mode. Please review carefully the DataType of your sort column and data stored in it. If you continue to experience problems, please send us a sample application demonstrating your scenario so that we can debug it locally. Thank you advance.

Sincerely yours,
Julian Benkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Thomas Van den Bossche
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Thomas Van den Bossche
Top achievements
Rank 1
Share this question
or