5 Answers, 1 is accepted
0
Kevin Babcock
Top achievements
Rank 1
answered on 01 Aug 2008, 01:46 AM
Hello K,
There are methods you can use to configure certain days in the RadCalendar to be unselectable.
First, you can declare a set of days in the SpecialDays collection. This collection requires that you specify a specific date, and allows you to disable that date from being selected. Fortunately, you can also set the Repeatable property so that every week day that is the same as the week day specified is also disabled (if the date you specified falls on a Monday, all Mondays will be disabled). This requires that you arbitrarily pick 5 dates which fall on the 5 week days and add them to the SpecialDays collection. Here is an example.
An alternative method is to use the client-side api to disable the dates. You can intercept the client-side DateClick event, check if the clicked day is a weekday, and disable it as you please. Here is an example of that method:
I hope this has been helpful. Please let me know if you have any further questions.
Regards,
Kevin Babcock
There are methods you can use to configure certain days in the RadCalendar to be unselectable.
First, you can declare a set of days in the SpecialDays collection. This collection requires that you specify a specific date, and allows you to disable that date from being selected. Fortunately, you can also set the Repeatable property so that every week day that is the same as the week day specified is also disabled (if the date you specified falls on a Monday, all Mondays will be disabled). This requires that you arbitrarily pick 5 dates which fall on the 5 week days and add them to the SpecialDays collection. Here is an example.
<telerik:RadCalendar ID="RadCalendar1" runat="server" > | |
<SpecialDays> | |
<telerik:RadCalendarDay IsSelectable="false" Repeatable="Week" Date="7/7/2008" /> | |
<telerik:RadCalendarDay IsSelectable="false" Repeatable="Week" Date="7/8/2008" /> | |
<telerik:RadCalendarDay IsSelectable="false" Repeatable="Week" Date="7/9/2008" /> | |
<telerik:RadCalendarDay IsSelectable="false" Repeatable="Week" Date="7/10/2008" /> | |
<telerik:RadCalendarDay IsSelectable="false" Repeatable="Week" Date="7/11/2008" /> | |
</SpecialDays> | |
</telerik:RadCalendar> |
An alternative method is to use the client-side api to disable the dates. You can intercept the client-side DateClick event, check if the clicked day is a weekday, and disable it as you please. Here is an example of that method:
<telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> | |
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server"> | |
<script type="text/javascript"> | |
function RadCalendar1_DateClick(sender, args) { | |
var day = args.get_renderDay(); | |
var isWeekend = day.get_isWeekend(); | |
if(!isWeekend) { | |
// unselect the day | |
day.Select(false); | |
// cancel the DateClick event | |
args.set_cancel(true); | |
} | |
} | |
</script> | |
</telerik:RadScriptBlock> | |
<telerik:RadCalendar ID="RadCalendar1" runat="server" > | |
<ClientEvents OnDateClick="RadCalendar1_DateClick" /> | |
</telerik:RadCalendar> |
I hope this has been helpful. Please let me know if you have any further questions.
Regards,
Kevin Babcock
0
Jatin
Top achievements
Rank 1
answered on 29 May 2009, 10:13 AM
Hi Kevin,
I am facing one problem in DateClick event of RAD Calendar control.
What I am doing is, I am programatically adding special days in a calendar control. I am doing this from server side DayRender method of calendar control.
I am facing one problem in DateClick event of RAD Calendar control.
What I am doing is, I am programatically adding special days in a calendar control. I am doing this from server side DayRender method of calendar control.
Private Sub RadCalNextDateSelection_DayRender(ByVal sender As Object, ByVal e As DayRenderEventArgs) Handles RadCalNextDateSelection.DayRender |
If e.Day.Date < Now.Date Then |
e.Day.IsSelectable = False |
e.Cell.BackColor = Drawing.Color.LightGray |
e.Day.IsDisabled = True |
RadCalNextDateSelection.SpecialDays.Add(e.Day) |
End If |
End Sub |
This dates are rendered properly. Also I am not able to select these dates. This is fine. Now when I tried to handle client side DateClick event of this control and when I click on the special days (for which I have set IsSelectable = false) ,
I find IsSelectable = true when I look at "args.get_renderDay()" on client side.
should I do something extra in order to get the correct value for "IsSelectable" property?
0
Hi Jatin,
Indeed, the present behavior is observed. I have escalated the issue to our developers, and they will soon correct this discrepancy.
Thank you for your report.
Regards,
Yavor
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Indeed, the present behavior is observed. I have escalated the issue to our developers, and they will soon correct this discrepancy.
Thank you for your report.
Regards,
Yavor
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jeppe
Top achievements
Rank 1
answered on 23 Sep 2009, 08:24 AM
Hi
I am using the RangeMinDate and RangeMaxDate in combination with adding some special days to avoid some dates being picked.(like Sundays) But the special days don not get dimmed out as the days limited by the RangeMinDate. It works that I canĀ“t select them but they are still clickable and the mouse changes on hover.
Is there a way to avoid this?
I am using the RangeMinDate and RangeMaxDate in combination with adding some special days to avoid some dates being picked.(like Sundays) But the special days don not get dimmed out as the days limited by the RangeMinDate. It works that I canĀ“t select them but they are still clickable and the mouse changes on hover.
Is there a way to avoid this?
0
Hello Jeppe,
You can apply a special style to the special day, to simulate a disabled effect.
Additional information on the possible styling of the special days is demonstrated in the following example:
http://demos.telerik.com/aspnet-ajax/calendar/examples/functionality/specialdays/defaultcs.aspx
I hope it gets you started properly!
All the best,
Yavor
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
You can apply a special style to the special day, to simulate a disabled effect.
Additional information on the possible styling of the special days is demonstrated in the following example:
http://demos.telerik.com/aspnet-ajax/calendar/examples/functionality/specialdays/defaultcs.aspx
I hope it gets you started properly!
All the best,
Yavor
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.