When I retrieve a SortDescriptors.Expression from my RadGridView the column names are not escaped when they have a space in the name. The FilterDescriptors.Expression does this correctly (IMO) or at least returns what I expect.
For example, I have a RadGridView bound to a DataTable with the following columns: ID, Unit ID, Name
I have the grid sorted by the column 'Unit ID' and also filtered to include only records where 'Unit ID'=1 at run-time.
I then run the following commands:
I get the following output:
With the FilterDescriptors.Expression value I can insert that string directly back into a SQL query with no issues. With the SortDescriptors.Expression I have to run an addional routine on the result before I can use it in a query.
I have a workaround I am using right now (simple string replace) but the inconsistant results were something I thought I should bring up here. Maybe the SortDescriptors could be changed to work more like the FilterDescriptors in the future? Anyway, this post is mainly an 'FYI' but if anyone has any comments or tips, they would be appreciated.
For example, I have a RadGridView bound to a DataTable with the following columns: ID, Unit ID, Name
I have the grid sorted by the column 'Unit ID' and also filtered to include only records where 'Unit ID'=1 at run-time.
I then run the following commands:
string sort = this.myRadGridView.SortDescriptors.Expression;
Console.WriteLine(sort);
string filter = this.myRadGridView.FilterDescriptors.Expression;
Console.WriteLine(filter);
I get the following output:
Unit ID ASC
([Unit ID] = 1)
With the FilterDescriptors.Expression value I can insert that string directly back into a SQL query with no issues. With the SortDescriptors.Expression I have to run an addional routine on the result before I can use it in a query.
I have a workaround I am using right now (simple string replace) but the inconsistant results were something I thought I should bring up here. Maybe the SortDescriptors could be changed to work more like the FilterDescriptors in the future? Anyway, this post is mainly an 'FYI' but if anyone has any comments or tips, they would be appreciated.