Link to home
Start Free TrialLog in
Avatar of dinesh_bali
dinesh_bali

asked on

Excel file checking using RegularExpressionValidator

Hi

I am working on ASP.net2.0, C#

I have a regular expression which checks if file is xls or not

It works fine, if we sellect the file from local system or map drive

But it does not work if we take the file from map drive

like
\\barney\Testing\Excel Example_R1.xls

My RegularExpressionValidator is

<asp:RegularExpressionValidator id="RegExpFile" runat="server" ErrorMessage=" "
ControlToValidate="FileUpload1" ValidationExpression="^.+\.((xls)|(XLS)|(Xls))$"></asp:RegularExpressionValidator>


Please help

This is very urgent for me
Avatar of ozo
ozo
Flag of United States of America image

It looks like the expression should work for
\\barney\Testing\Excel Example_R1.xls
Does it make any difference if you omit the "^.+"
Avatar of dinesh_bali
dinesh_bali

ASKER

Sorry, It was [a-zA-Z0_9].*\bxls\b

Is the ="^.+\.((xls)|(XLS)|(Xls))$

As I only want user should select only excel file, he should not able to select any other file

Thanks
ASKER CERTIFIED SOLUTION
Avatar of AlexNek
AlexNek

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial