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

Limiting the RadCalendar to 3 month window

1 Answer 74 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Unified Development
Top achievements
Rank 1
Unified Development asked on 22 Sep 2009, 02:36 PM
I have a RadCalendar initialized as follows:

<telerik:RadCalendar ID="radCalendar" runat="server" AutoPostBack="true"
            Skin="Special" EnableEmbeddedSkins="false"
            EnableMonthYearFastNavigation="false" NavigationNextToolTip="Next Month" NavigationPrevToolTip="Last Month"             
            DayNameFormat="Short" ShowRowHeaders="false" ShowOtherMonthsDays="false"
            OnDefaultViewChanged="RadCalendar1_DefaultViewChanged" OnDayRender="RadCalendar1_DayRender" >

My code behind handles calling a web service and populating the correct events into each day. What I want to be able to achieve is limiting the user from jumping ahead more than three months into the future. I know you can achieve this by the following line of code:

radCalendar.RangeMaxDate = now.AddMonths(3);

However, when the user clicks on next month to progress to say the 4th month the calendar is popping up a Javascript alert informing the user of an invalid date? Is there a way to turn that off or better, is there a way to either customize the message or to have the calendar navigation controls hide (per direction hopefully) when you hit the Min/Max Date for the calendar?

What I would like is for the user to never be able to look at a month in the past and only be able to view months within a 3 month window but without the default Javascript alert that pops up.

Any thoughts?

Thanks,
Derek







1 Answer, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 23 Sep 2009, 03:59 PM
In order to customize the alert they are receiving (at least the text) you will have to use the DatesOutOfRangeMessage property of the fast navigation. I'm not sure if this would work to remove it (since I'm not sure if it's an error or not) but if you define the OnError event  to do the following it will just cancel any error behavior within the calendar.

function OnError(sender, eventArgs)  
{  
   eventArgs.set_cancel(true); 
}  

You could also use the sample code provided by Telerik in this post to hide particular fast navigation controls.
Tags
Calendar
Asked by
Unified Development
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Share this question
or