Hello,
I have an issue with the WebMaskEditor control. If I use this code on my ASPX page:
Zip:<ig:WebMaskEditor ID="mskZip" runat="server" CssClass="TextBox" InputMask="00000-0000" Width="90px" /><asp:RegularExpressionValidator ID="zipValidator" runat="server" ErrorMessage="Invalid Zip Code" ValidationExpression="(^(?!0{5})(\d{5})(-?)(?!0{4})((\d{4})||(_{4}))?$)" ControlToValidate="mskZip">*</asp:RegularExpressionValidator> I cannot get the validator and the WebMaskEditor to play well together. The issue that I am having is the validation control will mark the mskZip value as invalid when the value is "55555-".The regular expression I am using should allow "5555-". As a matter of fact, it works great if I replace the WebMaskEditor with a regular ASP textbox. So I guess the issue I am really having is that the RegularExpressionValidator doesn't work the same with the WebMaskEditor control as it does with an ASP textbox. I thought the issue might be that the validation control was seeingthe underscores in the WebMaskEditor control so I modified the regular expression to account for those. Testing it yielded the same results. Again, if I replace the WebMaskEditor with a textbox it works as I would expect.Here is what the code looks like whenever I replace the WebMaskEditor with a textbox:Zip:<asp:TextBox ID="mskZip" runat="server" CssClass="TextBox" Width="90px" /> <asp:RegularExpressionValidator ID="zipValidator" runat="server" ErrorMessage="Invalid Zip Code" ValidationExpression="(^(?!0{5})(\d{5})(-?)(?!0{4})((\d{4})||(_{4}))?$)" ControlToValidate="mskZip">*</asp:RegularExpressionValidator>
Any idea how I can work around this issue?
Kevin
Hello Kevin,
Please let me know if you have any further questions regarding this issue.
Hello Kevin,The issue you are facing is due to the mask you are using. The validation from the expression is ok. The validation of the mask is what fails. When you are usin 0 it means a digit and obligatory digit. You can use 9 instead of zero and then the validation should pass. Please let me know what is the result of your tests with the following declaration:
<
ig:WebMaskEditor ID="mskZip" runat="server" CssClass="TextBox" InputMask="00000-9999"
/>Please also refer to the following page - http://help.infragistics.com/NetAdvantage/ASPNET/2011.2/CLR4.0/?page=WebMaskEditor_Overview_of_Masks.html which contains detailed information which could help you build the InputMask you are looking for.
Nikifor,
Thanks for your assistance.
I am using NetAdvantage ASP.NET 2010.3 (10.3.20103.1013)
Internet Explorer 9 (9.0.8112.16421)
Visual Studio 2010
Hello Kevin,Thank you for posting in our community. Can you please specify the exact version and build of NetAdvantage you are using. I will test the code and i will provide you with my findings. Also it would be nice if you specify the browsers you are using to test and your CLR.