Validating the SingleAttachmentPlaceholderControl
The SingleAttachmentPlaceholderControl
, like the other placeholder controls, can’t be validated with the default ASP.NET server-side validation controls. In this section, we will build a custom validation control, named RequiredAttachmentPhValidator
, that checks to see if a file has been uploaded to the control. If no attachments have been uploaded, the page will not be saved.
As before, we will first find out how to read off the content of the SingleAttachmentPlaceholderControl
. We will then write the client-side JavaScript that will perform the checking to be used within our validator.
Stored Values of the SingleAttachmentPlaceholderControl
Let’s take a look at the generated code for the SingleAttachmentPlaceholderControl
. Among the various elements that make up the code, the SingleAttachmentPlaceholderControl
contains several key hidden form fields as highlighted below:
. . . code continues . . . <table border="1" cellpadding...