I have this custom method
public IActionResult getEmbassyByUser(string user_id)
{
var embassy = baicDb.UserEmbassies.Where(c => c.user_id == user_id).Select(c => c.embassy_id).ToList();
//var embassy = [1,2];
return Json(new { embassy });
}
That returns an int list.
I want to filter datagrid with this lis but I can´t. Is there another solution.
And in radzen console I get this:
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
An unhandled exception has occurred while executing the request.
System.ArgumentException: Expression of type 'System.Collections.Generic.List1[System.Nullable1[System.Int32]]' cannot be used for parameter of type 'System.Collections.Generic.IEnumerable1[System.Int32]' of method 'Boolean Contains[Int32](System.Collections.Generic.IEnumerable1[System.Int32], Int32)'
Parameter name: arg0
at System.Dynamic.Utils.ExpressionUtils.ValidateOneArgument(MethodBase method, ExpressionType nodeKind, Expression arguments, ParameterInfo pi, String methodParamName, String argumentParamName, Int32 index)
at System.Linq.Expressions.Expression.Call(Expression instance, MethodInfo method, Expression arg0, Expression arg1)
But I don't understand why, I tried as your example, without variable:
I’ve just noticed that you are using custom server method instead data-source invoke - my approach with query builder will not work in this case. You can add second parameter to the server method and pass the value as normal parameter. If you hold Radzen license you can send us your project at info@radzen.com to check what's going on.
This is what I get in the back end error (Internal 500 error). I created an empty app and use the multi-select option and set the same set up as above.
An unhandled exception occurred while processing the request.
ArgumentException: Expression of type 'System.Collections.Generic.List1[System.Nullable1[System.Int32]]' cannot be used for parameter of type 'System.Collections.Generic.IEnumerable1[System.Int32]' of method 'Boolean Contains[Int32](System.Collections.Generic.IEnumerable1[System.Int32], Int32)'
Parameter name: arg0
Thank You, Korchev, I have figured out my issue after you gave me that link. The reason why I am having issue is because I was filtering it base from a related table. Basically I expand the child related table and use for example ChildTable/ChildTableID in (${myArray})