Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8610335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:06:25+00:00 2026-06-12T04:06:25+00:00

i am using the Microsoft Ajax Toolkit CalendarExtender control, to add calendar drop-down functionality

  • 0

i am using the Microsoft Ajax Toolkit CalendarExtender control, to add calendar drop-down functionality to a regular TextBox:

<asp:TextBox ID="edStartDate" runat="server" />
<asp:CalendarExtender ID="CalendarExtender1" runat="server" 
      TargetControlID="edStartDate" />

Which works fine for most client locales. It seems that the control does a server-request in order to convert a DateTime into a localized String.

For example, today (October 1st, 2012) displays fine in Arabic 15/11/33:

enter image description here

And also displays fine in Lower Sorbian 1. 10. 2012:

enter image description here


But some locales do not display properly in .NET 1////10////2012:

enter image description here

In this case i need some sort of OnFormatDate event, that i can supply the correct localization of a date to a string. Which leads to my question:

How to override AjaxToolkit CalendarExtender date to string conversion?


Note: Don’t confuse the question with the example.

  • i’m asking how to customize the conversion of a date to a string in a CalendarExtender
  • even if i’m not dealing with a bug in .NET, it doesn’t change my question
  • even if i’m not dealing with a CalendarExtender, i’m still asking the question
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:06:27+00:00Added an answer on June 12, 2026 at 4:06 am

    i used the same solution i used in a native Win32 application.

    The CalendarExtender uses the “Short date” format (d). The fix is to work around the bug in .NET:

    String format = CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern;
    
    format = FixDotNetDateTimeFormatStringsBug(format);
    
    CalendarExtender1.Format = format; //starts as "d", the "Short date" format
    

    with our helper-fixer:

    public String FixDotNetDateTimeFormatStringBug(String format)
    {
       //The bug in .NET is that it assumes "/" in a date pattern means "the date separator".
       //What .NET doesn't realize is that the locale strings returned by Windows
       // are the *Windows* format strings. 
       //The bug is exposed in locale's that use two slashes as for their date separator:
       //      dd//MM//yyyy
       //Which .NET misinterprets to give:
       //      30////11////2011
       //when really it should be taken literally to be:
       //      dd'//'MM'//'yyyy
       //which is what this fix does:
    
       return = format.Replace("/", "'/'");
    }
    

    Or, if you like more concisely:

    CalendarExtender1.Format = FixDotNetDateTimeFormatStringsBug(
          CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern);
    

    Note: Any code is released into the public domain. No attribution required.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I want to use ASP.Net without the Microsoft AJAX Control Toolkit or JQuery
Our team has been using Microsoft's AJAX Toolkit since the days of Atlas. In
I'm using microsoft's CDN for pulling down the Ajax libraries. And I'm using SSL
I am using a jQuery plugin and running it through the Microsoft Ajax Minifier.
HI folks, I have a .net application (vb.net) and I'm using the ajax control
I am trying to create a dynamic UI using UpdatePanel of AJAX toolkit. Let
I'm using Microsoft Ajax to dynamically populate a list of contacts, given a json
We wrote a couple of controls using Microsoft AJAX (cs class + js class).
I am running into a problem with Ajax and C# asp.net. I am using
Alright so I'm using Microsoft's Web Services and AJAX to get information from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.