We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Set DatePicker value with multiple Grids

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)


<SfGrid TValue="ServiceDto"


DataSource="dto.Service" >


<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;

if (!_selectedServiceDate.HasValue)






filterDate = _selectedServiceDate.HasValue ? _selectedServiceDate.Value.ToShortDateString() : null;

grid.FilterByColumn("ServiceDate", "contains", filterDate);



3 Replies 1 reply marked as answer

SP Sarveswaran Palani Syncfusion Team February 2, 2023 02:38 AM UTC

Hi Adam,

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.


AS Adam Swearingen February 2, 2023 04:35 PM UTC

Thanks! I was able to get a solution using the example in this article as reference:

Marked as answer

SG Suganya Gopinath Syncfusion Team February 6, 2023 05:20 AM UTC


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. 


Suganya Gopinath. 

Live Chat Icon For mobile
Up arrow icon