Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a regular expression  like below what my goal when user changed dropdown country in that  ddl country selected index depending on the country i have setted

VatRegularExpression = sp.CountryVatRegularExpressionGet(ddlCountry.SelectedValue)  ---here i  am getting regular expression from database

If Not String.IsNullOrEmpty(VatRegularExpression) Then
RegtxtVatCode.Enabled = True
RegtxtVatCode.ValidationExpression = VatRegularExpression
End If

<asp:RegularExpressionValidator ID="RegtxtVatCode" Enabled="false"
runat="server" ControlToValidate="txtVatCode" Display="Dynamic" CssClass="help-block"
ErrorMessage="<%$ Resources: res, WrongVatCode %>">
</asp:RegularExpressionValidator>

But my problem is when there is no VatRegularExpression value. for example when i select country germany there is no regular expression for this country.then also still it is giving the error message but it should not give the error message.Can you help me out please


What I have tried:

i have tried many things not working
Posted
Comments
Vincent Maverick Durano 18-Nov-18 12:51pm    
What's the value of VatRegularExpression for germany or for country that doesn't have RegEx?
Laxmidhar tatwa technologies 19-Nov-18 0:11am    
hi sir you check String.IsNullOrEmpty .in else block may asign RegtxtVatCode.ValidationExpression = ""
Rakib Ahmed 21-Nov-18 11:20am    
thanks i have solved the problem

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