RadzenProgressBar

HI
I am using a radzenProgressBar that associated a submit button.
Before submit button is clicked, the radzenprogressBar is hidden or invisible, when the submit button is clicked, the radzenprogressBar visible, after the sumbit function finishes the job, then progressBar invisible again.

My codes like:

<div style="height: 53px" class="row" Visible="@isLoading">
  <RadzenProgressBar style="height: 24px; width: 839px" Mode="ProgressBarMode.Indeterminate" Value="100" Visible ="@isLoading">
  </RadzenProgressBar>
</div>

submit function is:

    protected async System.Threading.Tasks.Task 

OnSubmit(SoftwareImageDto dtoadd)
{
isLoading = true;
// do something
isLoading = false;
}

this does not work, do I do something wrong?
Thank you for help!

John

add below code after isloading=true
await Task.Delay(500);

This is a common misconception about how Blazor works. The UI is updated after all code finishes execution. At the end of the OnSubmit method isLoading will be false so the progressbar will never appear. This stackoverflow thread explains more: https://stackoverflow.com/questions/56604886/blazor-display-wait-or-spinner-on-api-call

1 Like

thank you, Vinod_Pillai and Korchev!