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

Causing a PostBack on date navigation but not date selection

1 Answer 79 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
iTools
Top achievements
Rank 1
iTools asked on 15 Dec 2009, 07:56 PM
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?

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 16 Dec 2009, 06:27 AM
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.

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

javscript:
 
<script type="text/javascript"
    function OnCalendarViewChanging(sender, eventArgs) { 
        sender.set_autoPostBack(true); 
    } 
</script> 

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

-Shinu.
Tags
Calendar
Asked by
iTools
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or