Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #103493
    Nguyễn Thành

    how to use responseHandler in blazor ? when i add attribute responseHandler =”@myObject” then the interface will be lost

    A&M Detailing

    Nice post, thanks for sharing here.


    Hi Nguyễn Thành,

    responseHandler requires a JS callback function. So to use it in Blazor, you will need JS Interop.
    For example:
    @using Microsoft.JSInterop
    @inject IJSRuntime JS
    protected override void OnInitialized() {

    In the _Host.cshml, or index.html depending on whether you use Server-side or WASM Blazor, add this;

    window.addResponseHandler = () => {
    const fileUpload= document.querySelector(‘smart-file-upload’);
    fileUpload.responseHandler = function(xhr){ if(xhr.status === 404) {console.log(‘Not Found’);}};

    If you wish to use only Blazor with no JS, you can also use the OnUploadCompleted and OnUploadError events.

    Best Regards,
    Ivan Peevski
    Smart HTMLElements Team

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.