Subscribe - It's FREE!!

Stay Connected Here

Stay Updated With Us Here



Google

Hide retry button in kendo UI upload on error


Share with WhatsApp


This post covers information about how you can hide retry or refresh button which comes when any file upload fails or you throw an error after validating the uploaded file.

In one of my implementation I supposed to hide this "Retry" button and force user to reselect the correct files if any upload fails along with the error message for each failed upload.

Let's see how you can achieve this kind of functionaliy for Kendo UI Upload.

Suppose you have Kendo UI Upload defined like below.

@(Html.Kendo().Upload()
    .Name("fileUploader")
           .Async(a => a
           .Save("UploadActionName", "ControllerName")
           .AutoUpload(true)
           .Batch(false)
    )
   .Events(events => events.Error("onErrorUplaod"))
   .Multiple(true)
   .ShowFileList(true)
   .Messages(m => m.Select("Select file(s)"))


Then you need to handle Error event like below

function onErrorUplaod(e) {          
    var err = e.XMLHttpRequest.responseText;          
    $(".k-retry").parent().hide();
    $("span[title='" + e.files[0].name + "']").html(e.files[0].name + "<br/><p style='overflow-x:auto;overflow-y:hidden'>" + err + "</p>");
}

That's it. With above code retry button will get hidden and also the error message will get displayed below each failed file. I have not handled all validation so you may require to add some code to the above code.

Hope you have benefitted with above code. Let me know in comment section if you are facing any issues with above code. Thanks.



If you enjoyed this post take 5 seconds to share it! Be Socialable. :-)

Share with WhatsApp

Posts To Read Next

How to call click or any event only once in jQuery

Know how to execute an click event or any event only once for any element in jQuery. Perform action only once and even not required to unbind event.


Top 10 Visual Studio things which can boost developers coding speed

Visual Studio 2012 provides some coding features by which you can code faster if use them properly. This post will cover top 10 things among them to boost your development speed.


Typewriter - Automatic TypeScript Template generation from C# classes in Visual Studio

Typewriter, an extension for visual studio that generates TypeScript files from C# code files using TypeScript templates. Convert your C# model classes to TypeScript automatically.


Speed up coding in Visual Studio with code snippets & samples at your fingertips

Know how you can speed up coding in Visual Studio with Bing Developer Assistant by having millions of code snippets and sample projects at fingertips.


Assembla - Free and private repository to manage your source code online with SVN subversion hosting

With Assembla you can share source code with others online. Free & Private source code repository with SVN Subversion, Git & Perforce Hosting.


Your opinion is valuable for us! Comments, suggetions are welcome.


Submit your Email Id to stay updated with us and get notified with our new posts. It's FREE!
We know this popup is disturbing you!
But We would greatly appreciate if you share us with your friends below!

It will not take more than 2 seconds but will motivate us greatly to write more,share more!

x