I´m using C# and ASP.NET for developing in Windows Azure.
I want to do a global Method to validate fields, my idea is to do a global Method like (for example in Site.Master)
static Regex dateRegex = new Regex("^\\d{2}/\\d{2}/\\d{4}$");
public boolean validate( string type, string stringToValdate)
{
boolean valid = NO;
if (type = "date")
{
Match m = fechaRegex.Match(stringToValdate);
if(m.Success)
{
valid = true;
}
}
return valid;
}
And then use it in another webform
using ????
Site.Master.validate("date",TextBox1.Text);
99/99/9999as well). Global static stuff is a strong code smell btw., you should avoid that and use more suitable techniques.new Regex("^\\d{2}/\\d{2}/\\d{4}$", RegexOptions.Compiled);