for example: if some textbox has the incorrect format a valitonsummary displays the error message, but the uploaded files disappear, its like the control reset.
anyone knows how to stop the reset after PostbackTrigger?
thanks
7 Answers, 1 is accepted
![](/forums/images/avatarimages/39919b70-532f-465f-8efd-7edb2fc108a71.jpg)
![](/forums/images/avatarimages/default.gif)
![](/forums/images/avatarimages/default.gif)
Is there any way to persist the upload control across a postback when the page does not validate?
Unfortunately at the moment it is not possible to validate the AsyncUpload on the server with the ASP.NET Validators. There are two things, which you can do:
- Validate AsyncUpload on the client with the ASP.NET Custom Validator
- Or to use Custom Handler and perform server side validation in the Process() method.
Regards,
Hristo Valyavicharski
Telerik
![](/forums/images/avatarimages/default.gif)
![](/forums/images/avatarimages/default.gif)
anyone solve this problem in 2020 ? :P
Please share how to Validate AsyncUpload on the client with the ASP.NET Custom Validator
Hello,
For the client-side validation to work properly, the custom validator must have its client-side functionality enabled:
<telerik:RadAsyncUpload ID="RadAsyncUpload1"
runat="server" >
</telerik:RadAsyncUpload>
<asp:CustomValidator ID="cvUploadFiles"
EnableClientScript="true"
ClientValidationFunction="validateUpload"
runat="server" ValidationGroup="UploadErrors"
ErrorMessage="You must select one file to upload."
Display="None"></asp:CustomValidator>
Then, the validation function must get a proper reference to the async upload control or it will throw errors (you can read more on the subject below):
- https://docs.telerik.com/devtools/aspnet-ajax/general-information/get-client-side-reference
function validateUpload(sender, args) { var uploadobj = $find("<%=RadAsyncUpload1.ClientID%>"); args.IsValid = uploadobj.getUploadedFiles().length != 0; }
Also, if .NET 4.5+ is used, the following web.config entry should be set:
- http://stackoverflow.com/questions/16660900/webforms-unobtrusivevalidationmode-requires-a-scriptresourcemapping-for-jquery
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
Regards,
Peter Milchev
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.