Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MaskedEditExtender DateTime mask

Status
Not open for further replies.

BillKuhn

Programmer
Jun 1, 2007
21
US
I'm using VS2008 with the current crop of AjaxToolkit tools.

On a textbox, I am attempting to use a MaskedEditExtender to show/get properly formatted datetime strings. I've set masktype to DateTime, mask to '99/99/9999 99:99', cultureName to en-US, and AcceptAMPM to True (full declaration below).

If I set the Text property of the textbox with a properly formatted DateTime string, it displays nicely (including AAM or PM).

If I click on the textbox, the AM/PM designator disappears. I can type A or P at the end of the time segment and AM or PM appears, but when I leave the textbox the AM/PM designator disappears again. The underlying text property is apparently correct as I can save the text and it is saved with AM/PM properly, but it is not displayed on postback.

Basically, it appears to be saving the datetime in proper format, but the AM/PM indicator is not consistant.

??Help?

-- source below --

<cc1:MaskedEditExtender ID="TxtInitialDate_MaskedEditExtender" runat="server"
AcceptAMPM="True" Century="2000" ClearMaskOnLostFocus="False"
CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder=""
CultureDateFormat="" CultureDatePlaceholder="" CultureDecimalPlaceholder=""
CultureThousandsPlaceholder="" CultureTimePlaceholder="" Enabled="True"
Mask="99/99/9999 99:99" MaskType="DateTime"
TargetControlID="TxtInitialDate" CultureName="en-US">
</cc1:MaskedEditExtender>

Bill Kuhn - MCSE
bkuhn@kuhngroup.com
The Kuhn Group, Inc.
 
I guess the solution is to not use the MaskedEditExtender at all. It is undocumented (as with all the AJAXToolKit controls) and unreliable.

I was really hoping to see a way for ASP textboxes to handle input formatting without major contortions now that we are 5+ years into .NET. Alas, ASP.NET is still back in the 1970s as far as ease of use goes.

Bill Kuhn - MCSE
bkuhn@kuhngroup.com
The Kuhn Group, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top