Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All

I have a File uploader control and a button called ADD. When I click the ADD buttion, the selected file format(PDF) will be validated using RegularExpressionValidator and ValidatorCalloutExtender. It is working fine. The problem is, the validation error message is being displayed after postback too. Could any one help on this issue?

I am using the below code

XML
<asp:FileUpload ID="fuFileUpload" runat="server" />
                                <asp:Button ValidationGroup="fileUploadValidation" ID="btnUpload" OnClick="btnUpload_Click" runat="server"
                                    Text="Add" class="seaBtn" />
                                <asp:RegularExpressionValidator SetFocusOnError="true" runat="server" ID="revUpload" ControlToValidate="fuFileUpload"
                                    Display="None" ValidationGroup="fileUploadValidation" ErrorMessage="Only PDF or JPG files are Allowed."
                                    ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.jpg|.JPG.|.pdf|.PDF)$" />
                                <asp:ValidatorCalloutExtender ID="vceUpload" runat="server" TargetControlID="revUpload"
                                    PopupPosition="BottomLeft" WarningIconImageUrl="~/Images/icons/error.png">
                                </asp:ValidatorCalloutExtender>
Posted
Comments
[no name] 29-Apr-13 10:10am    
are you using partial page updates using update panel?
[no name] 29-Apr-13 10:14am    
are you also doing server side validation ?

1 solution

I think your issue is related to server side validation.. please have look at http://forums.asp.net/t/1661317.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900