0

I'm trying to create an textbox with a date input mask, such as "dd/mm/yyyy". The mask should be displayed before the textbox gains focus and when the user enters the date, the mask should still be displayed but be automatic overwritten with the entered numbers.

I tried looking at the Ajax control toolkit, which works fine except that I can't set the prompt string only a single character. Is there a workaround or some other controls I can use?

Muhammad Akhtar
  • 51,913
  • 37
  • 138
  • 191
Karsten
  • 8,015
  • 8
  • 48
  • 83

1 Answers1

1

Use TextBoxWatermarkExtender for that

  <cc1:MaskedEditExtender ID="mee" runat="server" AcceptNegative="Left"
  DisplayMoney="Left" ErrorTooltipEnabled="True" Mask="99/99/9999" MaskType="Date"
  TargetControlID="txt">    </cc1:MaskedEditExtender>
  <cc1:TextBoxWatermarkExtender ID="wme" TargetControlID="mee" WatermarkText="MM/dd/yyyy" runat="server" /> 
Muhammad Akhtar
  • 51,913
  • 37
  • 138
  • 191
  • But as soon as I give focus to the textbox, the watermark is hidden right? I would like it to be displayed while editing, so I would overwrite the mask with the entered date. – Karsten Sep 15 '10 at 12:02
  • But a nice suggestion anyway, if nothing better shows up - I'll go with this one – Karsten Sep 15 '10 at 12:22