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

RowFilter for date is a string?

2 Answers 67 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nathan
Top achievements
Rank 1
Nathan asked on 25 Jun 2010, 01:41 AM
I have a bit of a mystery on my hands.  I have a radgrid that is getting data from a dataset (passed threw the business object from the data access object, comming from ORM), that works perfectly.  The data shows up properly, and can sort and filter properly in the grid.  I have a custom export to Excel function that exports filtered data.  In this export process, I retrieve the information from the same method mentioned before, and apply the radgrid's filter to the data by accessing RadGridSomeGrid.MasterTableView.FilterExpression.  The issue that I am having is that when I access the filter here, it shows that it is trying to filter it as a string.  This doesn't work against the DateTime data coming in from the DataSet.

The filter as it comes from FilterExpression: "(([Accident Date] >= '1/1/10') AND ([Accident Date] <= '6/1/10'))"
The filter works if I manipulate it like so: "(([Accident Date] >= CAST('1/1/10' AS DateTime)) AND ([Accident Date] <= CAST('6/1/10' AS DateTime)))"

How can I accomplish this without tons of logic to seperate my individual filters, determine if it's supposed to be a date, locate the parameter, and wrap it?

Thanks,
Nathan

2 Answers, 1 is accepted

Sort by
0
Accepted
Veli
Telerik team
answered on 30 Jun 2010, 01:04 PM
Hi Nathan,

In .NET 2.0 or with EnableLinqExpressions="false" in .NET 3.5, RadGrid uses SQL syntax to build the filter expression. The SQL-style filter expression should be fully compatible with DataTables and DataSets, though.

Attaching a test page where the same scenario seems to work OK.

Sincerely yours,
Veli
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Nathan
Top achievements
Rank 1
answered on 30 Jun 2010, 06:40 PM
I should have responded to my post after discovering this, but I found this little nugget a few days ago, and it worked perfectly.
Tags
Grid
Asked by
Nathan
Top achievements
Rank 1
Answers by
Veli
Telerik team
Nathan
Top achievements
Rank 1
Share this question
or