DatePicker calendar unresponsive after setting date server side

2 posts, 0 answers
  1. J
    J avatar
    35 posts
    Member since:
    Oct 2012

    Posted 08 Oct 2013 Link to this post

    Basically, when I try to set the date through something like this:

    RadDatePicker1.SelectedDate = DateTime.ParseExact(dateToConvert, "yyyyMMdd", CultureInfo.InvariantCulture);

    the calendar popup button stops working. Any ideas?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 08 Oct 2013 Link to this post

    Hi J,

    Please try the following code snippet to set the SelectedDate of RadDatePicker using ParseExact.

    protected void RadDatePicker1_Load(object sender, EventArgs e)
        string dateString ,format;
        dateString = "06/15/2008";
        format = "d";
        CultureInfo provider = CultureInfo.InvariantCulture;
        DateTime result = DateTime.ParseExact(dateString, format, provider);
        RadDatePicker1.SelectedDate = result;
    Note: Please follow this documentation.

    Alternate Method to set SelectedDate:
    RadDatePicker1.SelectedDate = DateTime.Today;

    Hope this will help you

Back to Top