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

Month navigation causes postback

3 Answers 129 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Phil H.
Top achievements
Rank 2
Phil H. asked on 02 Dec 2008, 05:49 PM
I am gettting a performance problem with the RADCalendar control.  When one scrolls to a different month a postback occurs.  I need a postback only on selected date changed.

3 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 03 Dec 2008, 08:48 AM
Hi Phil Huhn,

One suggesction to achieve this functionality is, set the AutoPostBack property to true on client side in "OnDateSelected" eventhandler and then set the "AutoPostBack" to false from the server side in PageLoad event.

ASPX:
<telerik:RadCalendar ID="RadCalendar1" Runat="server" AutoPostBack="true">  
    <ClientEvents OnDateSelected="OnDateSelected" /> 
</telerik:RadCalendar> 

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

C#:
protected void Page_Load(object sender, EventArgs e)  
{  
    RadCalendar1.AutoPostBack = false;  


Thanks,
Princy.
0
Phil H.
Top achievements
Rank 2
answered on 03 Dec 2008, 01:18 PM
That is a cool interplay between client and server side!  I have a feeling the above solution is used in many other situations.  So, I renamed the JavaScript function to 'OnChangePostBack' and placed the script in the master-page.
0
Mattias
Top achievements
Rank 1
answered on 09 Apr 2010, 01:23 PM
Hi,
Just found this thread and I'm using the approach to. Nice!
But I think it should be integrated into the calendar with a property, like: EnableOnlyClientSideNavigation=true/false

Regards,
Mattias
Tags
Calendar
Asked by
Phil H.
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Phil H.
Top achievements
Rank 2
Mattias
Top achievements
Rank 1
Share this question
or