I have a foreach loop to display 1 to many grids, and I need a datepicker filter on one of the columns. With the current code, it sets the Date on all grids, instead of the just the one grid I am picking that date on. How would I set the datepicker date on only the one grid that is being filtered?
foreach (var dto in _invoice)
<GridColumn Field=@nameof(ServiceDto.ServiceDate) HeaderText="Service Date" Format="d">
<SfDatePicker TValue="DateTime?" Value="@_selectedServiceDate" ValueChanged="HandleSelectedServiceDateFilterChange" ID="ServiceDate_filterBarcell" />
public void HandleSelectedServiceDateFilterChange(DateTime? value)
_selectedServiceDate = value;
filterDate = _selectedServiceDate.HasValue ? _selectedServiceDate.Value.ToShortDateString() : null;
grid.FilterByColumn("ServiceDate", "contains", filterDate);
Greetings from Syncfusion support.
From your query, we suspect that you want render FilterTemplate in specific column on dynamic column binding. We suggest you to use if condition within the filter template using column field based on your requirement. If we misunderstood your query, kindly share a issue reproducible runnable sample to us for further evaluating an issue at our end.
Thanks! I was able to get a solution using the example in this article as reference:
We are glad that you could find the article useful. Please get back to us for further assistance.
We are marking this ticket as solved.