Hello everyone.
In a multiuser, muticulture project, I have the necessity to save the grid settings.
I have the following use case:
- One User , with CurrentThread.CurrentCulture == "de-DE", wants to save the grid setting for a table with a column of type "GridDateTimeColumn".
- User filters for DateTime element. The FilterExpressionValue is something like that :
((CreatedDate >= DateTime.Parse(\"03.12.2015,00:00:00\")) AND (CreatedDate <= DateTime.Parse(\"19.12.2015,23:59:59\")))"
- User saves the grid settings
- User changes his culture to "en-US"
- User loads grid settings
The loaded FilterExpression doesn't work properly because RadGrid expects a DateTime in "en-US" format (MM/dd/yyyy) but get one in "de-DE" (dd.MM.yyyy).
There is the same problem with GridNumericColumn columns.
To solve it I performed the following solution.
I don't save/load directly the FilterExpression string, but on "Save" event i just save the CurrentFilterValue/CurrentFilterFunction for the single columns parsing GridDateTimeColumn and GridNumericColumn in "InvariantCulture" format.
On "Load" event I load the CurrentFilterValue/CurrentFilterFunction parsing it in culture dependent format, and I generate the FilterExpression joining the FilterExpressions (EvaluateFilterExpression() method) of the single columns.
I wanted to know if it is the best approchor or there are better solutions.