This is a migrated thread and some comments may be shown as answers.
Switching the months in multimonth view
2 Answers 32 Views
This is a migrated thread and some comments may be shown as answers.
Ivaylo
Top achievements
Rank 1
Ivaylo asked on 10 Jan 2011, 03:48 PM
Hi,

I have a question about the calendar control. I am having a multi-month view which displays 3 adjacent months. If , for example, I am currently viewing January, February and March, and I press the button for the next months, I get the next three months (April, May, June), which is probably the calendar's default behavior. Is there a way to make the calendar display for example (February, March, April) while performing the same action. Also if there is a way to control the number of months being preserved while switching to the next set it will be useful. This is needed to keep track of the previous month set's special dates while adding some new special dates to the current month set. Any clues will be well appreciated.

Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 1
answered on 11 Jan 2011, 08:12 AM
Hello,
You can achieve this by client side code. Here is the sample code.

aspx:
<telerik:RadCalendar ID="RadCalendar1" runat="server" MultiViewColumns="3"
      <ClientEvents OnCalendarViewChanging="CalendarViewChanging" />
</telerik:RadCalendar>

JavaScript:
<script type="text/javascript"
function CalendarViewChanging(sender, eventArgs) 
    __doPostBack("<%= RadCalendar1.UniqueID %>", "n:1"); 
</script>

Shinu.
0
Ivaylo
Top achievements
Rank 1
answered on 11 Jan 2011, 01:56 PM
Thanks, this almost did it. For custom offsets use 'n:?', where '?' is the number of months to shift. Use negative values to switch backswards and positive forwards. To determine if the we are moving forward or backwards, use the eventArgs.get_step() method. It returns an integer of the default step - the number of visible months which is negative for moving backwards. Also, do not forget to call eventArgs.set_cancel(true) because the original event is also called on the server.
Asked by
Ivaylo
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Ivaylo
Top achievements
Rank 1
Share this question
or