Unplanned
Last Updated: 03 Nov 2020 11:19 by ADMIN
ADMIN
Marin Bratanov
Created on: 24 Aug 2017 12:48
Category: Grid
Type: Feature Request
1
DateTime FilterExpression should not contain commas and should be in invariant culture for SQL syntax (when EnableLinqExpressions=false)
You would get something like

(([createddate] >= '01/08/2017,00:00:00') AND ([createddate] <= '14/08/2017,23:59:59'))

while you should get something like

(([createddate] >= '01/08/2017 00:00:00') AND ([createddate] <= '14/08/2017 23:59:59'))

so that the SQL syntax is valid.

RadGrid, does not send the FilterExpression to the SqlDataSource, however. It executes the SELECT statement and then filters the resulting data on its own. This works fine.

If you will be performing operations yourself, you could use a string operation before passing the filter expression. For example:

protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
	if (!string.IsNullOrEmpty(this.RadGrid1.MasterTableView.FilterExpression))
	{
		if (this.RadGrid1.MasterTableView.FilterExpression.Contains("createddate"))
		{
			this.RadGrid1.MasterTableView.FilterExpression = this.RadGrid1.MasterTableView.FilterExpression.Replace(",", " ");
		}
		DataView dv =GetData("select * from [myTable] where ", this.RadGrid1.MasterTableView.FilterExpression);
                //where you would need to have something like (([createddate] >= '01/08/2017 00:00:00') AND ([createddate] <= '14/08/2017 23:59:59'))
		this.RadGrid1.DataSource = dv;
	}
}

Note that implementing such a change may break existing code that relies on the current syntax that contains the comma.
0 comments