Hi,
I have 2 RadCalender on my window form just llike Microsoft Outlook which will show selection of date on Top Calender and Bottom calender don't have any selection. But my Bottom calender on my form has selection and tried to remove it but no success. If i don't set focusdate or selected date on bottom calender, it takes either default value set at design time or default Jan 1900. I want same behaviour as in Microsoft Outlook. Please help.
I have 2 RadCalender on my window form just llike Microsoft Outlook which will show selection of date on Top Calender and Bottom calender don't have any selection. But my Bottom calender on my form has selection and tried to remove it but no success. If i don't set focusdate or selected date on bottom calender, it takes either default value set at design time or default Jan 1900. I want same behaviour as in Microsoft Outlook. Please help.
7 Answers, 1 is accepted
0
Hello Rajeev,
You can use the SelectedDate or SelectedDates collection if you want to do some custom behavior with the selection in RadCalendar. There are some properties such as AllowSelect, AllowMultipleSelect which could be of help.
You can also iterate through all of the cells in RadCalendar and set the cell's Selected property to false.This will cause the deletion of any visual selection state in RadCalendar. Also, you can call the InvalidateCalendar method of RadCalendar to refresh all its states to the values set.
To iterate through the cells you can use:
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
You can use the SelectedDate or SelectedDates collection if you want to do some custom behavior with the selection in RadCalendar. There are some properties such as AllowSelect, AllowMultipleSelect which could be of help.
You can also iterate through all of the cells in RadCalendar and set the cell's Selected property to false.This will cause the deletion of any visual selection state in RadCalendar. Also, you can call the InvalidateCalendar method of RadCalendar to refresh all its states to the values set.
To iterate through the cells you can use:
foreach (CalendarCellElement cell in radCalendar1.RootElement.Children[0].Children[0].Children[2].Children[0].Children[1].Children)
{
CalendarCellElement cl = cell as CalendarCellElement;
d.Selected = false;
}
I hope this helps. Please contact me if you need more information.
Best wishes,
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Charlie
Top achievements
Rank 1
answered on 30 May 2008, 05:58 AM
Hi, I'm trying to de-select "today" in a RadCalendar. Looking for RadControls' equivalent of visual studio's MonthCalendar.ShowTodayCircle. Iterating through the elements didn't work for me.
I'm using Q1 2008; not using SP1 coz it broke one of my grids
Thanks,
Charlie
I'm using Q1 2008; not using SP1 coz it broke one of my grids
Thanks,
Charlie
0
Hi Charlie,
Thank you for contacting us.
I can suggest the following:
1. Subscribe to the ElementRender event of RadCalendar
this.radCalendar1.ElementRender += new Telerik.WinControls.UI.RenderElementEventHandler(radCalendar1_ElementRender);
Best wishes,
Boyko Markov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Thank you for contacting us.
I can suggest the following:
1. Subscribe to the ElementRender event of RadCalendar
this.radCalendar1.ElementRender += new Telerik.WinControls.UI.RenderElementEventHandler(radCalendar1_ElementRender);
2. In the EventHandler of this event, please include the following code:
void radCalendar1_ElementRender(object sender, Telerik.WinControls.UI.RenderElementEventArgs e)
{
if (e.Element as CalendarCellElement != null)
{
(e.Element as CalendarCellElement).Today = false;
}
}
Best wishes,
Boyko Markov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Charlie
Top achievements
Rank 1
answered on 02 Jun 2008, 02:06 AM
Hi again. Thanks for the reply.
The solution you gave worked for the current month, but if you navigate to the previous month, "today" would still be highlighted and in a different way. Sort of like a negative highlight if that makes sense.
Charlie
The solution you gave worked for the current month, but if you navigate to the previous month, "today" would still be highlighted and in a different way. Sort of like a negative highlight if that makes sense.
Charlie
0
Hi Charlie,
I've tested the behavior I have sent you only with the default theme of RadCalendar. After your response, I've tried it with the other themes too. If there is a special coloring for the other months' days, you can use the following:
void radCalendar1_ElementRender(object sender, Telerik.WinControls.UI.RenderElementEventArgs e)
{
if (e.Element as CalendarCellElement != null)
{
(e.Element as CalendarCellElement).Today = false;
(e.Element as CalendarCellElement).OtherMonth = false;
}
}
As you can see, the CalendarCellElement class has a special behavior in different situations depending on selection, today's date, other month date, etc.
I hope this helps.
Greetings,
Boyko Markov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
I've tested the behavior I have sent you only with the default theme of RadCalendar. After your response, I've tried it with the other themes too. If there is a special coloring for the other months' days, you can use the following:
void radCalendar1_ElementRender(object sender, Telerik.WinControls.UI.RenderElementEventArgs e)
{
if (e.Element as CalendarCellElement != null)
{
(e.Element as CalendarCellElement).Today = false;
(e.Element as CalendarCellElement).OtherMonth = false;
}
}
As you can see, the CalendarCellElement class has a special behavior in different situations depending on selection, today's date, other month date, etc.
I hope this helps.
Greetings,
Boyko Markov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Charlie
Top achievements
Rank 1
answered on 06 Jun 2008, 12:16 AM
Oh right, forgot to mention I was using the Office2007Black theme. I ended up turning off the ShowOtherMonthsDays in the designer; gets rid of the problem.
I tried your solution and it actually shows other month's days like this month's, probably something in the theme. Thanks for your help.
Charlie
I tried your solution and it actually shows other month's days like this month's, probably something in the theme. Thanks for your help.
Charlie
0
Hi Charlie,
I'm happy to hear that.
Indeed, it will show the other month's day as the month's when we set the OtherMonth property to false.
Another solution was to hide the other month's days, but I thought that you will need them.
Anyway, if you have any further questions on RadCalendar, do not hesitate to write me back.
Kind regards,
Boyko Markov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
I'm happy to hear that.
Indeed, it will show the other month's day as the month's when we set the OtherMonth property to false.
Another solution was to hide the other month's days, but I thought that you will need them.
Anyway, if you have any further questions on RadCalendar, do not hesitate to write me back.
Kind regards,
Boyko Markov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center