Wednesday 8 May 2013

Validate Extension Of Selected File In File Uploader Before Uploading in Asp .Net C#

Validate Extension Of Selected File In File Uploader Before Uploading in Asp .Net C#Using RegularExpressionValidator ..
  
 <asp:FileUpload ID="fuParon" runat="server" />

<asp:RegularExpressionValidator id="RegularExpressionValidator1" runat="server"
            ErrorMessage="Only Excel file is allowed!"
            ValidationExpression ="^.+(.xls|.xlsx)$" ControlToValidate="fuParon"
            style="color: #FF5050" ValidationGroup="upload" ></asp:RegularExpressionValidator>


<asp:ImageButton ID="BtnUpload" runat="server"   ImageUrl="uploadimage.png"  Width=30px                  Height=30px  ValidationGroup="upload"  />

No comments:

Post a Comment

IE7 Issues Text Indent

                 Unfortunately IE 7 is still widespread among the users hence while theming we have to give special importance to the grea...