Causing a PostBack on date navigation but not date selection

2 posts, 0 answers
  1. iTools
    iTools avatar
    28 posts
    Member since:
    Jun 2007

    Posted 15 Dec 2009 Link to this post

    I want to have my RadCalendar let the user select as many dates as they want on the calendar without causing a postback to the server, because I have a Submit button that causes the PostBack once the user is satisfied with the date selections.

    But, I also set Special Days for each month (public holidays, non-working days, special events, etc.) within the view startdate and enddate on the server-side. I cannot do this client-side. Therefor, I need the DefaultViewChanged server-side event to be raised so I can refresh the new Special Days for the given view. Hence, a PostBack is required.

    How can I cause a PostBack raising the DefaultViewChanged server-side event, but no PostBack for a date selection?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 16 Dec 2009 Link to this post

    Hi Jan,

    You can achieve this functionality by setting the AutoPostBack property to true on client side in "OnCalendarViewChanging" eventhandler and then set the "AutoPostBack" to False from server side.

    <telerik:RadCalendar ID="RadCalendar1" runat="server" OnDefaultViewChanged="RadCalendar1_DefaultViewChanged" 
        <ClientEvents OnCalendarViewChanging="OnCalendarViewChanging" /> 

    <script type="text/javascript"
        function OnCalendarViewChanging(sender, eventArgs) { 

        protected void RadCalendar1_DefaultViewChanged(object sender, Telerik.Web.UI.Calendar.DefaultViewChangedEventArgs e) 
            RadCalendar1.AutoPostBack = false

Back to Top