How to use RadDatePicker with a "MM/yyyy" formatted DateInput

Thread is closed for posting
1 posts, 1 answers
  1. Answer
    Telerik Admin
    Telerik Admin avatar
    1679 posts
    Member since:
    Oct 2004

    Posted 27 Feb 2010 Link to this post


    RadControls for ASP .NET AJAX version

    2008.3.1105 and later

    .NET version

    2.0 and later

    Visual Studio version

    2005 and later

    Programming language

    Javascript, C#

    Browser support

    all browsers supported by RadControls


    Some client scenarios may require the embedded RadDateInput to be formatted with "MM/yyyy" date format. This is not a problem if the user enters a full date value (day,month,year). However, if the value contains only "month" and "year" parts (e.g "05/2010"), the embedded parsing mechanism of the RadDateInput control will parse the "month" part as a day and apply the current month to form the final date. This help topic provides more details about how RadDateInput parsing works.

    In order to avoid the built-in parsing the developper must construct the date manually before it is applied to the input. As stated above this should be done only if the entered date misses its "day" part. The most appropriate approach to do that is to use the client side OnValueChanging event. The exact implementation is demonstrated in the attached sample project.

    The demonstrated implementation could be considerably simplified if the developer knows in advance the exact date format that the user is expected to use. Currently the project allows different date formats and date separators which requires some additional Javascript coding.
Back to Top