Hi, I would like to know the best way to refresh events in a read-only scheduler that display a Team's work in progress (blazor server).
The envents are modified by other apps in the same database.
I am thinking of using RefreshEventsAsync() with a timer but would like to know the best way to do it to avoid memory leak.
<SfSchedule @ref="SchedulerRef" TValue="AppointmentData" Width="100%" Height="650px" @bind-SelectedDate="@CurrentDate" @bind-CurrentView="@CurrentView">
<ScheduleEvents TValue="AppointmentData" Created="OnCreated" Destroyed="OnDestroyed"></ScheduleEvents>
public Timer? RefreshTimer;
public void OnCreated()
RefreshTimer = new Timer(async _ =>
if (SchedulerRef != null)
}, null, 60000, 60000);
public void OnDestroyed()
if (RefreshTimer != null)
Thank you for your response.
I have implemented your code but I have an error on await Calendar.RefreshEventsAsync();
System.InvalidOperationException : 'The current thread is not associated with the Dispatcher. Use InvokeAsync() to switch execution to the Dispatcher when triggering rendering or component state.'
I don't see what is wrong with my code.
Do you know what raises this error ?
We suspect that the end-to-end sample customization on your sample project may be causing the problem. Please share the below details to proceed further.
Hi Ravikumar ,
Just to inform you that it works now as expected after some old code update.
Thanks for the information that the issue has been resolved. Let us know if you need any other assistance.