TIP: Display IsBusy on long server method

Hi Team,

I was out in the wild looking for a simple way to update the Blazor UI, in order to display a nice waiting tiff and/or display the Radzen 'IsBusy' state of a button, before starting long server based methods.
The way it is working by default is that on the button event being launched the server method is first launched, and when that is completed the UI will update and show your nice waiting tiff - much too late.

The simplest way I could find was on this link:

The most simple method mentioned here works quite nicely for me, just by adding "await Task.Delay(1)" will cause the thread with the server method to pause - The thread updating the UI will then quickly run and show your nice tiff.

    public async Task<int> FileUpload(string folder_str, string file_str, int AnalyserFileID)*
    {
        await Task.Delay(1);
        try
        {..........................
3 Likes