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);
You can use
Extension Method
on Master TypeUse Case :