Say I have a list of object and I want a field to show one specific value from those objects.
public class Data
{
public List<Obj> Objects { get; set;}
}
public class Obj
{
public string Name { get; set;}
public int Id { get; set;}
}
Data reportData = [
{Name: abc, Id: 4 },
{Name: def, Id: 5 }
]
I want to show the Name (in a textbox) where Id = 5. How do I do that?
I tried doing it with a user function where I pass the array but it throws an error when I try to cast object back to Obj class that (webservice.jsonObject can't be cast to Obj class). If I can't cast the object to Obj class, how am I supposed to filter it?
Hi Miftaul,
If you have assigned the datasource to the report, then you can add a List and set its Binding property as follows:
Property path: DataSource
Expression: =Fields.Objects.
Then, add textboxes for =Fields.Name and =Fields.Id. Finally, set the Filters property of the list.
Expression: =FIelds.Id
Operator: =
Value: =5
@Neli
Did something similar with table. But it's bothersome to do this for a simple filter. My datasourse has nested objects that I need to filter.
I wish I could pass the objects to a user function for filtering. I already have the classes but telerik sends these objects as JsonObject which I can't convert back into its proper class.
Hi Miftaul,
Can you please send us a sample runnable project that reproduces the problem, so I can inspect it locally? Note that it is not necessary to include real data. Also, you can provide a screenshot of the desired outcome.