Facing problem in Calendar control while navigating to next month

3 posts, 0 answers
  1. Sagar
    Sagar avatar
    2 posts
    Member since:
    Aug 2012

    Posted 17 Aug 2012 Link to this post

    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. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 20 Aug 2012 Link to this post

    Hello Sagar,

    You should remove the following line:

    rCal.RegisterWithScriptManager = false;

    As that is the reason why you're RadCalendar control is breaking.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Sagar
    Sagar avatar
    2 posts
    Member since:
    Aug 2012

    Posted 27 Aug 2012 Link to this post

    Thanks kevin.. It works.. Thanks a lot.
Back to Top