Image control change event

Hello Team,
I am trying to set a flag in the change event of file input control.


Blazor Code

              <div class="col-md-3">
                <RadzenFileInput MaxFileSize="512000" Title="Clear" @bind-Value="@(docsreceived.Image)" Name="Image" Change="@ImageChange" Error="@ImageError">
                </RadzenFileInput>
              </div>

c# Code

        protected async System.Threading.Tasks.Task ImageChange(string args)
        {
            docsreceived.Received=args!=null || args!="" ?true:false;
        }

I am getting below error in VS 2019

So unable to compile the above code.
Kindly advise.

You are binding the Change and Error, which are of type EventCallback, directly to your method. You should use lambda instead, and pass the ChangeEventArgs as parameter:

Change=@((args) => ImageChange(args)) Error=@((args) => ImageError(args))

Try setting a custom attribute with name TValue and Value string. For some reason Radzen didn't infer that out of the box. We will investigate it further.

1 Like

@korchev Thanks a Ton!. Issue resolved :star_struck:

It was inferred by radzen. Setting the TValue attribute resolved the issue. Thanks for your time. :slight_smile: