Could you please help me with the problem as under.
How can i change color of selected date according to my wish or different colors by c# codes.
I am having dates from datebase which are the selected dates in your calender control those are displayed and selected correctly but when i selected another date excluding those date the selected dates are disappear
What I need is the newly selected data and those came from database should be remain selected.
Currently we are using the demo version of your control if we get solution of above problem we ill buy 2 to 3 license version of your control
Thanking you,
Tabs BI Software Team.
6 Answers, 1 is accepted
I can suggest you setting the SelectionMode property equal to "Multiple". This approach will help you keeping the last selected dates when a new one is presented. Write us back if this is not your case.
Best wishes,
Kaloyan
the Telerik team
Hi Kaloyan,
I have already set my Calendar to multiple Selected Dates Mode, and it is working as per my need.
But the Problem which was in the first place that i want to change the background of the Selected Dates to different colors as per the Different Dates or the Data attached to those Dates.
i.e. For Example:- The Dates to be selected are 10th Dec, 15th Dec, and 20th Dec. Then i want the Background of the Selected Dates in the Calendar as
10th Dec - Blue Color Background, 15th Dec - Red Color Background, and 20th Dec - Green Color Background.
Could please guide me and help me solve this Issue and if solution is there then could you please also give the code for the same.
Thanks & Regards,
Aavadesh,
Tabs BI Software Team.
I have prepared a small app with a custom implementation of the DayTemplate. Follow the code and write us back if it is not helping you.
All the best,
Kaloyan
the Telerik team
How can i change color of selected date according to my wish or different colors by c# codes.
i select one date that change the color but if i select another date then first date not selected...
for eg. if i select 15 then it will be red but if i select 16 then 15 is deselect.
i want multiple date selected and color also
In order to achieve the desired appearance you could use the DayTemplatSelector of RadCalendar. It provides the possibility to modify the default Template of the content of each CalendarButton - you could apply different templates for the different dates using your own custom logic. However, please notice that each time you select a new date the template should be applied again. That could be achieved by using the following code:
private
void
RadCalendar_SelectionChanged(
object
sender, SelectionChangedEventArgs e)
{
this
.Calendar.DisplayDate = Calendar.DisplayDate.AddMonths(1);
this
.Calendar.DisplayDate = Calendar.DisplayDate.AddMonths(-1);
}
We have created a sample project that demonstrates the described above approach - please, check it.
We hope this will help you.
Regards,
Nasko
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.
I am selecting a date and showing it in red color. But when i select the same date again, no color comes for it and value of date comes as 0/0/0001. I want the color of date to remain the same(i.e, red) , no matter how many times i click it.
Also if i am selecting dates outside the month, i don't want to show any color for such dates.