RadCalendar value changes to RangeMinDate when clicking on highlighted date

6 posts, 0 answers
  1. Chris
    Chris avatar
    2 posts
    Member since:
    Aug 2012

    Posted 20 Feb 2012 Link to this post

    When using a RadCalendar and if a user clicks on the currently selected date, the SelectedDate value of the RadCalendear will change to the RangeMinDate.  I'm currently using version 2011.3.11.1219. Please let me know if I'm missing something or a common work around for this.

    Thanks,
    Chris
  2. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 23 Feb 2012 Link to this post

    Hi Chris,

    Thank you for contacting us.

    This is the default behavior of RadCalendar. When you click on a cell that is selected, it is being deselected, hence the SelectedDate equaling the RangeMinDate. However this cell remains focused and visually appears as it was selected. If you do not want to deselect a date, you can subscribe to the SelectionChanged event and handle it the following way:
    void radCalendar1_SelectionChanged(object sender, EventArgs e)
    {
        if (this.radCalendar1.SelectedDate <= this.radCalendar1.RangeMinDate)
        {
            this.radCalendar1.SelectedDate = this.radCalendar1.FocusedDate;
        }
    }

    I hope you find this useful. Do not hesitate to write back if you have any additional questions.

    All the best,
    Ivan Todorov
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Manh
    Manh avatar
    5 posts
    Member since:
    Sep 2012

    Posted 19 Sep 2012 Link to this post

    Hi Ivan Todorov,

    But when i click back on RangeMinDate, an exception issued is that "Cannot evaluate expression because the current thread is in a stack overflow state."

    Please help me to solve my problem.

    Thanks,

    Manh


  5. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 21 Sep 2012 Link to this post

    Hi Mahn,

    This could happen only when you try to select the RangeMinDate. To overcome this, you should modify the code as shown below:
    private void radCalendar1_SelectionChanged(object sender, EventArgs e)
    {
        if (this.radCalendar1.SelectedDate <= this.radCalendar1.RangeMinDate &&
            this.radCalendar1.SelectedDate != this.radCalendar1.FocusedDate)
        {
            this.radCalendar1.SelectedDate = this.radCalendar1.FocusedDate;
        }
    }

    I hope this will help you. Should you have any further questions, do not hesitate to contact us.

    Kind regards,
    Ivan Todorov
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  6. Shaiky
    Shaiky avatar
    1 posts
    Member since:
    Jan 2015

    Posted 07 Jan 2015 Link to this post

    Hello Ivan,

    I had set my radcalenders min date and max date.but still it didnot reflect in the UI.

    below is my code:

     <telerik:RadCalendar runat="server" ID="dpDateOfBirth" OnSelectionChanged="dpDateOfBirth_SelectionChanged" MinDate="01/01/1900" RangeMinDate="01/01/1900" RangeMaxDate="12/31/2000" EnableMultiSelect="false" FastNavigationStep="12" AutoPostBack="true" TitleFormat="MMMM yyyy"  Visible="false">
     </telerik:RadCalendar>
  7. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 08 Jan 2015 Link to this post

    Hello,

    Your question seems to concern our ASP.NET AJAX controls, while this forum concerns the Telerik UI for WinForms controls. May I please ask you to post in the ASP.NET forum in order to get adequate response.

    Regards,
    Stefan
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for WinForms is Visual Studio 2017 Ready