ASP.Net - Validate postal/zip code based on Country
ASP.Net 2.0 comes with some powerful input validation controls. It's east to add a RequiredFieldValidator to a form, to ensure that the user inputs data of some sort. But what if you need data in a specific format? And what if that format changes? The example in this code uses a RegularExpressionValidator to check the proper format of a Zip code. However, if the user selects the country Canada, the regular expression changes to check for a valid postal code. (more…)
