Just filter the extensions
string ExcelFile;
string[] FindFiles = Directory.GetFiles("C:\\Wh
foreach (int ExcelFile in FindFiles) {
ComboBox1.Items.Add(ExcelF
}
vbturbo
Main Topics
Browse All TopicsHi,
I am working on Web Application using C#, ASP.Net2.0, MSSQL 2005
I need to upload the file, so I read the article from the MSDN
http://msdn2.microsoft.com
Now I want to upload only Excel file.
So, from MSDN I got this kind of validation we can put
<asp:RegularExpressionVali
id="RegularExpressionValid
ErrorMessage="Only mp3, m3u or mpeg files are allowed!"
ValidationExpression="^(([
+(.mp3|.MP3|.mpeg|.MPEG|.m
ControlToValidate="FileUpl
So, I changed the above code to as per my requirement as follows
<asp:RegularExpressionVali
id="RegularExpressionValid
ErrorMessage="Only Excel (.xls) files are allowed!"
ValidationExpression="^(([
+(.xls)$"
ControlToValidate="FileUpl
I get the error
Only Excel (.xls) files are allowed!
But I am chossing Excel file only has the path
C:\dinesh\Projects\Project
Please help me in correcting RegularExpressionValidator
Many Thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi,
I tried the expression you have given but not worked
I mean I tried
([a-zA-Z-]:(\\w+)*\\[a-zA-
This is quite urgent for me. Or If you have some other way of doing it.
I want the validation to perform on client side and message to display on screen rather than javascript alert
Many Thanks
Please help me
Hi,
Thanks for your reply,
No it is not working
I wrote
<asp:RegularExpressionVali
id="RegularExpressionValid
ErrorMessage="Only Excel (.xls) files are allowed!"
ValidationExpression="[a-z
ControlToValidate="FileUpl
I have selected the path
D:\dinesh\Project\1\Docume
and I get the error message
Only Excel (.xls) files are allowed
This is a small validation thing which I want
Please help me in resolving this issue. If this way it is not resolving than guide me some other way use anything else
But not javascript alerts
Many Thanks
Try validate before displaying the error message.
Your above code will never reach the validation part.
<asp:textbox id="textbox1" runat="server"/>
<asp:RegularExpressionVali
ControlToValidate="textbox
ValidationExpression=".*@.
ErrorMessage="* Your entry is not a valid e-mail address."
display="dynamic">*
</asp:RegularExpressionVal
vbturbo
Here you go
TESTED....................
<asp:textbox id="textbox1" runat="server"></asp:textb
<asp:RegularExpressionVali
ControlToValidate="textbox
ValidationExpression="[a-z
ErrorMessage="* Your entry is not a valid e-mail address."
display="dynamic"></asp:Re
vbturbo
Business Accounts
Answer for Membership
by: G0ggyPosted on 2007-02-21 at 08:36:45ID: 18579732
Check it with server side:
n(FileUplo ad1.FileNa me)
fileExt = System.IO.Path.GetExtensio
If (fileExt = ".mp3") Then
And see if it is the punctuation in your filename that is causing the problem.