Hi All: I have a webpage with 4 regular fileupload controls, and validation to prevent the page from being submited unless all 4 fileuploads are populated.
I use a customValidator both client-side and server-side to validate that all 4 fileupload controls have files and have the appropriate file extensions.
In my client-side validation I used logic like:
<script type="text/javascript"> function valUpload(source, args) { var pdf1 = document.getElementById('<%#fupPDF1.clientID %>').value; if (pdf1.length == 0) { source.innerText = "Attach file for upload 1"; args.IsValid = false;} else {args.IsValid = true;} }</script>
and server-side like:
If fupPDF1.HasFile and fupPDF1.fileName isnot nothing Then e.IsValid=true Else e.IsValid=false End If
I want to replace these fileuploads with ajaxFileUpload controls. I see that I can restrict each ajax control to a single file, and I can validate the file extensions from within each control. So far so good!
What I'd like to do is validate each control to make sure the end-user has uploaded a file, before submitting the form. Is there a way to do this within a customValidator?