I am not using a custom validator. During Post Back I am checking for few values and returning the page according to that. eg: I have a agreement checkbox, If it is not checked
An error label is shown with the same page. That is the case my FileUpload Control's Error Message also shown up.
Here is the code for my FileUpload
<
asp:FileUpload ID="UploadFile" runat="server" Width="182" /><asp:RegularExpressionValidator ID="PDFValidator" runat="server" ControlToValidate="UploadFile" Display="None" ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.pdf|.PDF)$"
ErrorMessage="<%$ Resources:My_Mannatech:MeetingModifyCreate:FileSizeMessage.Text %>" SetFocusOnError="true" ></asp:RegularExpressionValidator></td>
and my Code Behind is
protected void NextButton_Click(object sender, EventArgs e)
{
if (AgreementCheckBoxID.Checked && createMeetingControl.IsAllDataValid())
{
ErrorMessage.Visible = false;
CheckBoxErrorLabel.Visible =
false;
PreviousButtonID.Visible =
true;NextButton.Visible = false;
SubmitButton.Visible =
true;
AgreementCheckBoxID.Enabled =
false;
}
else
{
if (!AgreementCheckBoxID.Checked)
CheckBoxErrorLabel.Visible =
true;
elseCheckBoxErrorLabel.Visible = false;
}
}