Impossible to use a MaskedEditExtender/textbox dynamically in asp:calendar cell?

Apr 18, 2011 at 9:56 PM
Edited Apr 18, 2011 at 9:57 PM

Does anyone know how to do this?  The intuitive answer below is not the right answer.  I need some serious help on this one.


using AjaxControlToolkit;
namespace WebApplication1
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        int i = 1;
        protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
        {
            TextBox t = new TextBox();
            t.ID = "t" + i;
            e.Cell.Controls.Add(t);

            MaskedEditExtender mee1 = new MaskedEditExtender();
            mee1.AcceptAMPM = true;
            mee1.Mask = "99:99";
            mee1.MaskType = MaskedEditType.Time;
            mee1.TargetControlID = t.ID;
            mee1.ClearMaskOnLostFocus = false;
            mee1.ClientIDMode = System.Web.UI.ClientIDMode.Static;
            mee1.ID = "MaskedEditExtender" + i++;
            e.Cell.Controls.Add(mee1);
        }
    }
}