I'm trying to create a custom server control that is just a textbox with an AJAX asp.net MASKEDEDITEXTENDER to valid the control when it loses focus to ensure that a proper date has been entered.
This is all I have so far and I'm able to build the control but no validation is taking place what am I doing wrong here.
namespace One_Eva_Control_Library
{
[ToolboxData("<{0}:Valid_Date_Textbox runat=server></{0}:Valid_Date_Textbox>")]
public class Valid_Date_Textbox : System.Web.UI.WebControls.TextBox
{
#region Methods
/// <summary>
/// Creates Validator
/// </summary>
/// <param name="e">Init eventArg</param>
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
MaskedEditExtender meDateValidator = new MaskedEditExtender();
meDateValidator.ID = "dateExtender";
meDateValidator.Mask = "99/99/9999";
meDateValidator.MessageValidatorTip = true;
meDateValidator.MaskType = MaskedEditType.Date;
meDateValidator.UserDateFormat = MaskedEditUserDateFormat.DayMonthYear;
meDateValidator.CultureName = "en-GB";
MaskedEditValidator meEditValidtor = new MaskedEditValidator();
meEditValidtor.ControlExtender = meDateValidator.ID;
meEditValidtor.ControlToValidate = base.ID;
meEditValidtor.InvalidValueMessage = "Invalid Date";
meEditValidtor.Display = ValidatorDisplay.Dynamic;
meEditValidtor.TooltipMessage = "Input date in 99/99/9999 format";
meEditValidtor.InvalidValueMessage = "*";
meEditValidtor.ValidationGroup = "MKE";
}
#endregion
}