I m trying to do a control .dll to add it to the toolbox and that means that i dont want to write any code in .aspx page, the problem is that the mask dont understand that it must mask the inheited textbox my teacher said to me that i must put it in container and there is child control but i dont understand how
we must put it in container and use preRender if there is any help
i attached my code: here
under name
or here is it:
MyTextBox.cs
using System;using System.Collections;using System.Collections.Generic;using System.Linq;using System.Text;using System.Web;using System.Web.UI;using System.Web.Security;using System.Web.UI.HtmlControls;using System.Web.UI.WebControls;namespace MariamTextBox{ public class MyTextBox :TextBox { private Masks masks = Masks.None; private AjaxControlToolkit.MaskedEditExtender mask = new AjaxControlToolkit.MaskedEditExtender(); TextBox TextBox1 =new TextBox(); //public AjaxControlToolkit.MaskedEditExtender Mask //{ // get // { // return this.mask; // } //} public Masks masktype { get { return this.masks; } set { this.masks = value; switch (this.masks) { case Masks.Date: this.mask.TargetControlID = "TextBox1"; this.mask.Mask = Common.Common.DATE_TYPE; this.mask.MaskType = AjaxControlToolkit.MaskedEditType.Date; this.mask.OnFocusCssClass = Common.Common.ONFOCUSS_TYPE; this.mask.OnInvalidCssClass = Common.Common.ONINVALID_TYPE; this.mask.ErrorTooltipEnabled = true; this.mask.MessageValidatorTip = true; break; case Masks.Numeric: this.mask.TargetControlID = "TextBox1"; this.mask.Mask = Common.Common.NUMERIC_TYPE; this.mask.MaskType = AjaxControlToolkit.MaskedEditType.Date; this.mask.OnFocusCssClass = Common.Common.ONFOCUSS_TYPE; this.mask.OnInvalidCssClass = Common.Common.ONINVALID_TYPE; this.mask.ErrorTooltipEnabled = true; this.mask.MessageValidatorTip = true; break; case Masks.Time: this.mask.TargetControlID = "TextBox1"; this.mask.Mask = Common.Common.DATE_TYPE; this.mask.MaskType = AjaxControlToolkit.MaskedEditType.Date; this.mask.OnFocusCssClass = Common.Common.ONFOCUSS_TYPE; this.mask.OnInvalidCssClass = Common.Common.ONINVALID_TYPE; this.mask.ErrorTooltipEnabled = true; this.mask.MessageValidatorTip = true; break; default: this.mask.TargetControlID = ""; this.mask.MaskType = AjaxControlToolkit.MaskedEditType.None; this.mask.Mask = ""; break; } } } }}
the Common.resxDATE_TYPE 99:99:99 NUMERIC_TYPE 99/99/9999 ONFOCUSS_TYPE MaskedEditFocus ONINVALID_TYPE MaskedEditError TIME_TYPE 99/99/9999 the enum.cs namespace MariamTextBox{ public enum Masks { Numeric, Time, Date, None }} Thanx a lot
DATE_TYPE 99:99:99 NUMERIC_TYPE 99/99/9999 ONFOCUSS_TYPE MaskedEditFocus ONINVALID_TYPE MaskedEditError TIME_TYPE 99/99/9999
the enum.cs namespace MariamTextBox{ public enum Masks { Numeric, Time, Date, None }}
namespace MariamTextBox{ public enum Masks { Numeric, Time, Date, None }}