Regular expression validator firing after postback in

As usual, I’s really surprised to see what had happened when I attach a regular expression validator to one of my fileupload control. The regular expression validator was firing after every successful fileupload. Yup! The solution is way too simple. Simply, set the IsValid property of the regular expression validator to true.

protected void btnAddDocument_Click(object sender, EventArgs e)
    // your logic comes here
    regexvalUploadDoc.IsValid = true;

That’s it.