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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Disable dates in syncfusion Blazor DatePicker

Thread ID:

Created:

Updated:

Platform:

Replies:

151366 Feb 8,2020 02:40 AM UTC Jun 16,2020 10:59 AM UTC Blazor 3
loading
Tags: DatePicker
Douglas
Asked On February 8, 2020 02:40 AM UTC

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

Sureshkumar P [Syncfusion]
Replied On 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 


Malcolm Leck
Replied On 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!  


Berly Christopher [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon