I have code:
and
I want to do "PostBack", when the date is selected. After "PostBack" I want to execute method: "rdCalendar_SelectionChanged". How can I do it??
<trk:RadCalendar ID="rdCalendar" runat="server" DayNameFormat="FirstLetter" EnableMultiSelect="false" AutoPostBack="false"> |
<ClientEvents OnDateSelected="changeSchedulerView"/> |
</trk:RadCalendar> |
function changeSchedulerView(calendarInstance, eventArgs) |
{ |
__doPostBack('<%= rdCalendar.ClientID %>',eventArgs); |
} |
rdCalendar.SelectionChanged += new Telerik.Web.UI.Calendar.SelectedDatesEventHandler(rdCalendar_SelectionChanged); |
I want to do "PostBack", when the date is selected. After "PostBack" I want to execute method: "rdCalendar_SelectionChanged". How can I do it??
9 Answers, 1 is accepted
0
Chris Gillies
Top achievements
Rank 1
answered on 25 Oct 2007, 03:09 PM
Hi Mark,
If you set the calendar property AutoPostBack to true, this behavior will be automatically executed - the control will postback on click of a date and the SelectionChanged server-side will be fired. You can review it here:
http://www.telerik.com/DEMOS/ASPNET/Prometheus/Calendar/Examples/Programming/ServerSideEvents/DefaultCS.aspx
Regards,
Chris
If you set the calendar property AutoPostBack to true, this behavior will be automatically executed - the control will postback on click of a date and the SelectionChanged server-side will be fired. You can review it here:
http://www.telerik.com/DEMOS/ASPNET/Prometheus/Calendar/Examples/Programming/ServerSideEvents/DefaultCS.aspx
Regards,
Chris
0
Mark
Top achievements
Rank 1
answered on 25 Oct 2007, 03:42 PM
If I set the calendar property AutoPostBack to true, the page will be reloaded on every click (onClientcalendarviewchange, onClientdataselecting), but I want to reload the page only on dateclick.
0
Hi Mark,
Unfortunately such functionality is not supported -- RadCalendar works either in client mode (no postbacks) or in postback mode (date selection and month navigation trigger postback requests to the server).
Regards,
Manuel
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Unfortunately such functionality is not supported -- RadCalendar works either in client mode (no postbacks) or in postback mode (date selection and month navigation trigger postback requests to the server).
Regards,
Manuel
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Shaun Peet
Top achievements
Rank 2
answered on 29 Oct 2007, 02:51 AM
IMHO - it should offer this functionality though.
0
Hello Shaun,
Thank you for your feedback -- although we have no immediate plans of implementing such feature, we will forward it to our developers for further consideration.
Best wishes,
Manuel
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Thank you for your feedback -- although we have no immediate plans of implementing such feature, we will forward it to our developers for further consideration.
Best wishes,
Manuel
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Kevin
Top achievements
Rank 1
answered on 19 Dec 2007, 01:29 AM
Do you have any alternatives? I only want the body of my page to refresh if a date is clicked, not if the user navigates between months. Thank you.
0
Hi Kevin,
You can trigger the postback on date selection manually like this:
Hope this helps.
Kind regards,
Manuel
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
You can trigger the postback on date selection manually like this:
<script type="text/javascript"> |
function OnDateSelected(sender, args) |
{ |
var calendar = <%= RadCalendar1.ClientID %>; |
calendar.DoPostBack("d"); |
} |
</script> |
<radcln:RadCalendar ID="RadCalendar1" runat="server"> |
<ClientEvents OnDateSelected="OnDateSelected" /> |
</radcln:RadCalendar> |
Hope this helps.
Kind regards,
Manuel
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Drew
Top achievements
Rank 1
answered on 27 May 2009, 10:19 PM
this was a few years ago, have there been any changes made or does this still apply? i would only like to postback if a day is selected.
Drew
Drew
0
Princy
Top achievements
Rank 2
answered on 28 May 2009, 07:27 AM
Hi Drew,
The RadCalendar control support a number of client-side events and methods that let you respond to user actions without a postback. You can achieve the desired functionality by setting the AutoPostBack property from client side. Have a look at the following example.
ASPX:
JavaScript:
CS:
Regards,
Princy.
The RadCalendar control support a number of client-side events and methods that let you respond to user actions without a postback. You can achieve the desired functionality by setting the AutoPostBack property from client side. Have a look at the following example.
ASPX:
<telerik:radcalendar id="RadCalendar1" runat="server" AutoPostBack="True" OnSelectionChanged="RadCalendar1_SelectionChanged" OnDefaultViewChanged="RadCalendar1_DefaultViewChanged"> |
<ClientEvents OnCalendarViewChanging="OnCalendarViewChanging" OnDateClick="OnDateClick" /> |
</telerik:radcalendar> |
JavaScript:
<script type="text/javascript"> |
function OnCalendarViewChanging(sender, eventArgs) |
{ |
sender.set_autoPostBack(false); |
} |
function OnDateClick(sender, eventArgs) |
{ |
sender.set_autoPostBack(true); |
} |
</script> |
CS:
protected void RadCalendar1_SelectionChanged(object sender, Telerik.Web.UI.Calendar.SelectedDatesEventArgs e) |
{ |
// Your code |
// Response.Write("Selection changed"); |
} |
Regards,
Princy.