Parser: tweak the century

3 posts, 0 answers
  1. Philip
    Philip avatar
    5 posts
    Member since:
    Nov 2010

    Posted 06 Mar 2011 Link to this post

    When entering a date in the RadDatePicker, where the century is not specified (e.g. 6/20/76), is there a way to instruct the parser to deliver 1976 instead of 2076, short of reimplementing it?
    Even if SelectableDateEnd and DisplayDateEnd are set to DateTime.Now, the parser still selects the future date.

    Alternatively, is there a way to call your builtin parser (which works like a charm except for this small issue) from a custom Parse... event handler in order to tweak its result a bit?

    Thanks
    Phil
  2. Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 07 Mar 2011 Link to this post

    Hello Philip,

    You have to add an event handler to the ParseDateTimeValue event. There you can specify the desired result. Check the  most simple way how you can achieve that.

    private void radDateTimePicker_ParseDateTimeValue(object sender, ParseDateTimeEventArgs args)
            {
                if(args.Result.HasValue)
                {
                    args.Result = args.Result.Value.AddYears(-1000);
                }
      
                  
            }



    All the best,
    Kaloyan
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. UI for WPF is Visual Studio 2017 Ready
  4. Philip
    Philip avatar
    5 posts
    Member since:
    Nov 2010

    Posted 17 Mar 2011 Link to this post

    Hello Kaloyan,

    somtimes, the answer is so close... ;)

    Thank you
Back to Top