So I have a file Upload and want to show the progress in the progress bar. The problem is, that the OnProgress event writes a double value to the progress variable, while the ProgressBar requests an int-type value.
InvalidOperationException: Unable to set property 'value' on object of type 'Radzen.Blazor.RadzenProgressBar'. The error was: Unable to cast object of type 'System.Int32' to type 'System.Double'.
int progress;
double progress2 {
get
{
return Convert.ToDouble(progress);
}
set { }
}
Which leads to:
InvalidCastException: Unable to cast object of type 'Microsoft.AspNetCore.Components.EventCallback1[System.Double]' to type 'System.Action1[System.Double]'.
But if i change progress from int to double, i get that bad boy here:
System.InvalidOperationException: Unable to set property 'valueChanged' on object of type 'Radzen.Blazor.RadzenProgressBar'. The error was: Unable to cast object of type 'Microsoft.AspNetCore.Components.EventCallback1[System.Double]' to type 'System.Action1[System.Double]'.
OK I think I found the problem. When progress was an int type, I received compile errors when i used @bind-Value in the progress bar (with an uppercase v). So I changed it to @bind-value="progress", which compiled but threw the above errors. After changing progress to double and bind-Value back to uppercase V, it worked.
But, on a different note: When i upload the file, i post the file object to a controller. I read the excel file and transfer its content to a database , which takes about 6 to 8 seconds. I would like to provide a progress bar for the file upload (which now works) and for the transfer to the DB. So I need to send back frequent progress updates from the controller, which performs the db operations to the blazor app. Is that possible in any shape or form?