Hi all, I have a problem with regular expression validator. I have a file upload and I want to upload only Excel file. The problem is that after the postback, regular expression validator is shown. This is the code:
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="cmdUpload" runat="server" Text="Upload" ValidationGroup="Validators" /><br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="FileUpload1"
ErrorMessage="Insert a file" ValidationGroup="Validators"></asp:RequiredFieldValidator><br />
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="FileUpload1"
ErrorMessage="Insert only Excel File" ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.xls|.XLS|.xlsx|.XLSX)$"
ValidationGroup="Validators"></asp:RegularExpressionValidator>
Thanks in advance!
There are only 10 types of people in the world: Those who understand binary, and those who don't!