title: Required Field Validator + AsyncFileUpload
body: <p>I have been trying to apply the default ASP.Net Required Field Validator to an AsyncFileUpload control (from the AJAX Control Toolkit).</p>
  <hr />
  <h1>The Scenario</h1>
  <p>I have created a Web User Control. <strong>Let’s call it wucFileUpload.</strong></p>
  <p>wucFileUpload has an AJAX Update Panel that is wrapping the Required Field Validator and the AsyncFileUpload. <em>(I have to use the AJAX Update Panel for some particular reasons)</em>.</p>
  <p>wucFileUpload is going to be used in many pages, and in some of them, this control is going to be generated automatically, so I do not know how many of them I will have per page.</p>
  <p>wucFileUpload has a property called Required. If Required is true, it will enable the Required Field Validator, to check if the AsyncFileUpload has been filled at least once.</p>
  <hr />
  <h1>My try</h1>
  <p>I found <a href="https://stackoverflow.com/questions/2983909/how-to-add-required-validator-to-ajax-asyncfileupload">this solution here on StackOverflow</a>, and I tried to apply it. However, my case is a little bit different, from the one represented on that question.</p>
  <hr />
  <h1>My thoughts</h1>
  <p>I really liked the idea of having a hidden Textbox or a HiddenField. Because a single AsyncFileUpload can upload N number of files.</p>
  <p>The Textbox <strong>could get some value on the first time OnClientUploadComplete runs</strong>… this way I’ll know the user has uploaded at least one image.</p>
  <p>But I would also need a way of <strong>clearing that Textbox</strong>, because the user can delete the image that he just uploaded. And if the does that, then the field must be validated again.</p>