C# scripts to validate zip codes & strings
-
I need access to C# scripts for validating zip codes in three formats: ##### or #####-#### or ##### #### (no dash) & strings entered in forms @ ASP pages (running on .NET platform). Any help would be most appreciated! Many thanks!:eek: Reed Eichner reichner@satx.rr.com
-
I need access to C# scripts for validating zip codes in three formats: ##### or #####-#### or ##### #### (no dash) & strings entered in forms @ ASP pages (running on .NET platform). Any help would be most appreciated! Many thanks!:eek: Reed Eichner reichner@satx.rr.com
Take a look at the validators -- RequiredFieldValidator, RangeValidator, and RegularExpressionValidator -- as they encapsulate all of the functionality that should allow you to determine if something is in the right format to be a zipcode. There are samples here on CP and in MSDN. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
-
Take a look at the validators -- RequiredFieldValidator, RangeValidator, and RegularExpressionValidator -- as they encapsulate all of the functionality that should allow you to determine if something is in the right format to be a zipcode. There are samples here on CP and in MSDN. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.
John: thanks for your feedback! However, I'm not a proficient coder...do you have the links to the respective script (pre-written code) that I can download & incorporate into an ASPX page? Reed:zzz: Reed Eichner reichner@satx.rr.com
-
John: thanks for your feedback! However, I'm not a proficient coder...do you have the links to the respective script (pre-written code) that I can download & incorporate into an ASPX page? Reed:zzz: Reed Eichner reichner@satx.rr.com
Great - don't even try, and rip other people's code off for something so simple. You won't learn anything that way. Try reading the class documentation for these validators in the .NET Framework SDK. They even include samples. And things like the
RequiredFieldValidator
are so simple - all you have to do is set the control name to validate (ControlToValidate
property) and an error message (ErrorMessage
property) at the bare minimum.Microsoft MVP, Visual C# My Articles
-
John: thanks for your feedback! However, I'm not a proficient coder...do you have the links to the respective script (pre-written code) that I can download & incorporate into an ASPX page? Reed:zzz: Reed Eichner reichner@satx.rr.com
Reed, Sorry, not off the top of my head. I'd have to do just what Heath suggests or look them up, too. What a piece of work is man, how noble in reason, how infinite in faculties, in form and moving how express and admirable . . . and yet to me, what is this quintessence of dust? -- Hamlet, Act II, Scene ii.