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

Disable dates in syncfusion Blazor DatePicker

Hi

how can I  disable dates in syncfusion Blazor DatePicker?
like disable Sundays

it says it is allowed in the website but there is no documentation to explain it

3 Replies

SP Sureshkumar P Syncfusion Team February 10, 2020 09:11 AM UTC

Hi Douglas, 
 
Greetings from Syncfusion support.  
 
Yes, we can able to disable the date by using our OnRenderDayCell event. Kindly refer the below code example. Here we have disabled the Sundays based on your requirement. 
 
<EjsDatePicker TValue="DateTime?" ID="date"> 
    <DatePickerEvents TValue="DateTime?" OnRenderDayCell="@DisableSundays"></DatePickerEvents> 
</EjsDatePicker> 
 
 
@code { 
    public void DisableSundays(RenderDayCellEventArgs args) { 
        if ((int)args.Date.DayOfWeek == 0) { 
            args.IsDisabled = true; 
        } 
    } 
 
} 
 
Also, thanks for your valuable suggestion. We will add this information in our documentation and intimate you once the document has been published. We appreciate your patience until then  
 
Regards, 
Sureshkumar P 



ML Malcolm Leck June 15, 2020 05:50 AM UTC

I tried this piece of code for my SfCalendar components ( wrapped a DateTimePickerEvents inside) and it works for the initial load, but when i selected other available dates, the disabled dates become enabled. How can I resolve this issue? Thanks!  



BC Berly Christopher Syncfusion Team June 16, 2020 10:59 AM UTC

Hi Malcolm, 
  
Sorry for the inconvenience caused.  
We would like to inform you that, RenderDayCell event will worked as expected in the DateTimePicker component after hybrid support implementation is completed from our end. This support will be available in our upcoming Volume 2 Main release which is expected to be rolled out on end of June 2020. We appreciate your patience until then. 
  
You can track the status of this issue from the below feedback. 
  
Regards, 
Berly B.C 


Loader.
Live Chat Icon For mobile
Up arrow icon