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

Facing problem in Calendar control while navigating to next month

2 Answers 43 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Sagar
Top achievements
Rank 1
Sagar asked on 17 Aug 2012, 11:57 AM
Hi,
I have used calendar control in my application. The purpose of the calendar is to display the list of events which are occurring on the selected date. Its working fine when user selects any date. But if someone navigate to next month, the whole control is getting disabled. After navigating no one can selects the date nor navigate to previous month. I have used update panel for for calendar control.
Please have a look at the code and let me know the solution of this issue.
<div>
        <asp:UpdatePanel ID="upCalendar" runat="server" UpdateMode="Always" >
            <ContentTemplate>
                <telerik:RadCalendar ID="rCal" runat="server" AutoPostBack="true" EnableMultiSelect="false"
                    FastNavigationStep="3" EnableEmbeddedSkins="true" EnableEmbeddedBaseStylesheet="true"
                    EnableMonthYearFastNavigation="true" DayNameFormat="Short" ShowRowHeaders="true" 
                    ShowOtherMonthsDays="false" Skin="Default" Width="298px" OnSelectionChanged="rCal_SelectionChanged"
                    EnableViewState="true">
                    <TitleStyle CssClass="CalendarTitleStyle" /><SelectedDayStyle CssClass="CalendarDaySelectedClass" /><DayOverStyle CssClass="CalendarDayOverClass" />
                </telerik:RadCalendar>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                rCal.RegisterWithScriptManager = false;
                rCal.RangeMinDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                if (SelectedDateForSearch.HasValue)
                {
                    rCal.SelectedDate = SelectedDateForSearch.Value;
                    rCal.FocusedDate = SelectedDateForSearch.Value;
                }
             }
        }
 
 protected void rCal_SelectionChanged(object sender, Telerik.Web.UI.Calendar.SelectedDatesEventArgs e)
        {
            if (e.SelectedDates.Count > 0)
            {
                DateTime selectedDate = rCal.SelectedDate.Date;
                string url = "To any page"
                Response.Redirect(url);
            }
        }

2 Answers, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 2
answered on 20 Aug 2012, 12:55 PM
Hello Sagar,

You should remove the following line:

rCal.RegisterWithScriptManager = false;

As that is the reason why you're RadCalendar control is breaking.
0
Sagar
Top achievements
Rank 1
answered on 27 Aug 2012, 06:08 AM
Thanks kevin.. It works.. Thanks a lot.
Tags
Calendar
Asked by
Sagar
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 2
Sagar
Top achievements
Rank 1
Share this question
or