In our data, we have six different address lines; NameAddress1... NameAddress6. In a DataGrid, we are attempting to display, and filter, data conditionally. Instead of having two columns, we would like to display one value or the other.
For example, if NameAddress4 is empty, display NameAddress2, otherwise display NameAddress3. We can display the appropriate data with a Template like this:
<RadzenGridColumn Width="100px" TItem="RealEstate" Title="Mailing Address">
<Template Context="display">
@(string.IsNullOrEmpty(display.NameAddress4) ? display.NameAddress2 : display.NameAddress3)
</Template>
</RadzenGridColumn>
But, without the Property value set, we cannot filter. We tried adding a FilterTemplate, but could not make that work either. When we tried this:
<RadzenGridColumn Context="address" Width="100px" TItem="RealEstate" Title="Mailing Address" Property="@(string.IsNullOrEmpty(address.NameAddress4) ? display.NameAddress2 : display.NameAddress3)">
</RadzenGridColumn >
We get the error:
The name 'address' does not exist in the current context
I tried using a FilterTemplate with a dropdown of the values, but that was wonky because the data has several thousand rows.
Is there another possibility to display, and filter, the data?