Trigger a custom JavaScript function on Kendo Upload refresh button click

In Kendo Upload (MVC), error situations remove the upload button, leaving a refresh. How do I bind a custom jQuery function to that refresh control to conceal error alerts?

I managed a similar issue by binding the event using jQuery’s event delegation. Rather than attaching the click event directly, I used a delegated binding on a stable parent element, which catches clicks on the dynamically rendered refresh element. This ensured that the custom function was executed after the error removal. Although I needed to identify a reliable selector for the refresh control, this approach ultimately allowed me to hide the error alerts efficiently. This experience emphasizes the importance of event delegation for elements updated dynamically.

hey, i used the parent container’s click event to catch the refresh. then i fired my custom fn to hide errors. works reely well, give it a go if u face similar issues.

In my experience managing similar behavior in Kendo Upload, I decided to integrate a custom jQuery function that hooks into the dynamically rendered refresh control without altering core behaviors directly. Instead of working against Kendo’s built-in event handlers, I wrote a function that monitors changes in the upload container using a MutationObserver. This approach allowed me to seamlessly bind the custom logic each time an error condition triggered the refresh element, thereby ensuring that undesired error alerts were effectively concealed without interfering with core upload functionality.

I addressed this by harnessing Kendo Upload’s error callback itself to reapply my custom bindings post-error. My strategy involved unbinding any previous events and then directly attaching my custom function using jQuery’s on() method to the refresh element. This way, once an error removed the original upload button, my custom logic was immediately applied to the new element and prevented the unwanted error alerts. This method provided both a reliable hook and reinitialization whenever the error state was encountered.

hey, i solved it by using a small delay to rebind my custom function after errors. a settimeout ensured the refresh btn was present before attaching, which worked decently in my case. hope this helps!