This is a migrated thread and some comments may be shown as answers.

RadCalendar value changes to RangeMinDate when clicking on highlighted date

5 Answers 230 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 20 Feb 2012, 03:12 PM
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

5 Answers, 1 is accepted

Sort by
0
Ivan Todorov
Telerik team
answered on 23 Feb 2012, 10:42 AM
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 >>
0
Manh
Top achievements
Rank 1
answered on 19 Sep 2012, 08:32 AM
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


0
Ivan Todorov
Telerik team
answered on 21 Sep 2012, 01:16 PM
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 >>
0
Shaiky
Top achievements
Rank 1
answered on 08 Jan 2015, 02:31 AM
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>
0
Stefan
Telerik team
answered on 08 Jan 2015, 07:10 AM
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.

 
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Chris
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
Manh
Top achievements
Rank 1
Shaiky
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or