I'm trying to filter a grid in Server using Infragistics.Web.Mvc.FilteringExtensions and the "Where" function.
When de expression ("Expr" in FilterExpression object) is a double value I have a problem.
If "Expr" is "31.55", the "Where" function applies the "3155". And if "Expr" is "31,55", the "Where" function thow a exception.
in Infragistics.Web.Mvc.ExpressionParser.Parse(Type resultType)in Infragistics.Web.Mvc.DynamicExpression.ParseLambda(ParameterExpression parameters, Type resultType, String expression, Object values)in Infragistics.Web.Mvc.FilteringExtensions.Where(IQueryable source, String predicate, Object values)
I invoque "Where" function:
data.Where("ask_precio.Value > 30.23", new object})
How can I apply this filter?
Thank you for posting in our forum.
The Where() method in Infragistics.Web.Mvc throws this error because it tries to find a column with a key of “ask_precio.Value”. In case your columnKey is “ask_precio”, try removing the “.Value” and check if this would resolve the problem.
There is a detailed help topic that covers handling the remote Filtering manually on the server. It contains a code snippet which uses the Where() method when filtering the data using the expressions from the query string. You may read it here:
If you need any additional assistance, feel free to contact me.
I'm using "handling-remote-features-manually#filtering" solution.
The problem isn't a ".Value", because with a integer expression works well. I have tried removing ".Value" and the error is the same.
I add the ".Value" because the property "ask_precio" is nullable double (double?).
I was not able to reproduce this issue on my side. I have attached an isolated MVC sample that I have used when testing. It has a simple igGrid with the Filtering feature enabled and the Where() method gets used in the Controller in order to filter some of the records and store them in a variable. I have used a nullable double type in the Model instead of integer and everything works as expected.
Please try running the sample on your side and put a breakpoint at the end of the GetData() method in the Controller, just before the data gets returned to the View. This would allow you to inspect the “temp” variable and see if it shows only 5 records, as this is the expected result, which I get on my side. In case I am missing something, or the configuration does not resemble your scenario, please feel free to modify the sample until the behavior you describe occurs, then send it back to me so I could debug on my side and find what is causing the issue.
Your proyect doesn't work for me.
I'm seing empty the temp variable
You can see "Param_0.ProductName > Convert(35)" when it should be "Param_0.ProductName > Convert(3.5)"
I'm using "Infragistics.Web.Mvc" in source "C:\Program Files (x86)\Infragistics\2017.2\Ignite UI\MVC\MVC5\Bin\Infragistics.Web.Mvc.dll" with version "126.96.36.199"
I was able to reproduce this issue on my side. It seems to be related to the Spanish localization settings that you use, which change the decimal separator to a coma instead of a dot. Converting the value in the expression string to a type Double ignores the dot in that case, as it is not considered a valid character, and just concatenates the rest of the digits – thus you get an incorrect integer. Trying to change the separator to a coma would produce an incorrect expression, because the extended Where() method expects a number with a dot as a separator.
I am currently investigating if there is some way to workaround this problem – I will keep you posted of any available information.