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

Get sortExpression on client side

1 Answer 215 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Thomas Sonnenschein
Top achievements
Rank 2
Thomas Sonnenschein asked on 31 Jul 2012, 08:57 AM
Hello Community,

  I have a problem with the radGrid from Q3/2011 Version. On client Java script I have to get the actual sort expression of the grid. As the documentation stated, I used the following code:
var grid = $find ( ... gridClientId... )
 
// Grid is found, so get the sort expression
var masterTableView = grid.get_masterTableView();
var sortExpressions = masterTableView.get_sortExpressions();
But sortExpression is always empty even if my grid is definitely sorted by one column.

In the documentation I found the Note: The RadGrid get_sortExpressions() property is meaningful only in case the RadGrid control is bound client-side.

This I interpret, that, if the grids data is not bound from client side, I cannot get the sort expression this way.

My grid is bound to an ObjectDataSource. So how can I get the sortExpression?

Greetings
  Thomas

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 31 Jul 2012, 10:38 AM
Hi,

The sorting expressions could only be accessed on the client if Client-side binding for the RadGrid is used. You can access it from server side as shown below.
C#:
string sort = RadGrid1.MasterTableView.GetColumn("UniqueName").SortExpression.ToString();

Thanks,
Shinu.
Tags
Grid
Asked by
Thomas Sonnenschein
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Share this question
or