I am trying to put the iCalendar export functionality
http://demos.telerik.com/aspnet-ajax/scheduler/examples/export/defaultvb.aspx
into the Appointment context menu
http://demos.telerik.com/aspnet-ajax/scheduler/examples/contextmenu/defaultvb.aspx
Has anyone accomplished this yet and do they have a code snippet?
Thanks
http://demos.telerik.com/aspnet-ajax/scheduler/examples/export/defaultvb.aspx
into the Appointment context menu
http://demos.telerik.com/aspnet-ajax/scheduler/examples/contextmenu/defaultvb.aspx
Has anyone accomplished this yet and do they have a code snippet?
Thanks
3 Answers, 1 is accepted
0
Hi codispdp,
That shouldn't be hard to achieve. SImply handle AppointmentContextMenuItemClicking like so:
Regards,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
That shouldn't be hard to achieve. SImply handle AppointmentContextMenuItemClicking like so:
protected void RadScheduler1_AppointmentContextMenuItemClicking(object sender, AppointmentContextMenuItemClickingEventArgs e) { if (e.MenuItem.Value == "Export") { WriteCalendar(RadScheduler.ExportToICalendar(e.Appointment)); } } private void WriteCalendar(string data) { HttpResponse response = Page.Response; response.Clear(); response.Buffer = true; response.ContentType = "text/calendar"; response.ContentEncoding = Encoding.UTF8; response.Charset = "utf-8"; response.AddHeader("Content-Disposition", "attachment;filename=\"RadSchedulerExport.ics\""); response.Write(data); response.End(); }Regards,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
codispdp
Top achievements
Rank 1
answered on 18 May 2010, 04:16 PM
Thanks for your suggestion, I am using a RadAjaxManager on the page so the client code works using
I tried to implement the same code you suggested and received a SYS.Webforms.PageMangerParserErrorException because the response was trying to be modified. Is the a way to use the RadAjaxManager RaisePostBackEvent on the server side to mimic the same functionality as
| function Export(sender, e) |
| { |
| $find("<%= RadAjaxManager1.ClientID %>").__doPostBack(sender.name, ""); |
| } |
I tried to implement the same code you suggested and received a SYS.Webforms.PageMangerParserErrorException because the response was trying to be modified. Is the a way to use the RadAjaxManager RaisePostBackEvent on the server side to mimic the same functionality as
| Protected Sub RadScheduler1_AppointmentCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.AppointmentCommandEventArgs) Handles RadScheduler1.AppointmentCommand |
| If e.CommandName = "Export" Then |
| WriteCalendar(RadScheduler.ExportToICalendar(e.Container.Appointment)) |
| End If |
| End Sub |
0
Hi codispdp,
Indeed, exporting appointments requires a real postback. The good news is that RadAjaxManager's client API allows for easy solution to this problem. The idea is to set a flag in OnClientAppointmentContextMenuItemClicking and use this flag to disable ajax in OnRequestStart. Here is an example:
Regards,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Indeed, exporting appointments requires a real postback. The good news is that RadAjaxManager's client API allows for easy solution to this problem. The idea is to set a flag in OnClientAppointmentContextMenuItemClicking and use this flag to disable ajax in OnRequestStart. Here is an example:
<script type="text/javascript"> var ajaxFlag = true; function OnClientAppointmentContextMenuItemClicking(sender, args) { if (args.get_item().get_text() == "Export") { ajaxFlag = false; } } function OnRequestStart(sender, eventArgs) { eventArgs.set_enableAjax(ajaxFlag); ajaxFlag = true; } </script> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadScheduler1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadScheduler1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> <ClientEvents OnRequestStart="OnRequestStart" /> </telerik:RadAjaxManager> <telerik:RadScheduler ID="RadScheduler1" runat="server" OnClientAppointmentContextMenuItemClicking="OnClientAppointmentContextMenuItemClicking" OnAppointmentContextMenuItemClicking="RadScheduler1_AppointmentContextMenuItemClicking" Culture="fa-IR"> <AppointmentContextMenus> <telerik:RadSchedulerContextMenu ID="RadSchedulerContextMenu1" runat="server"> <Items> <telerik:RadMenuItem Text="Export"> </telerik:RadMenuItem> </Items> </telerik:RadSchedulerContextMenu> </AppointmentContextMenus> </telerik:RadScheduler>Regards,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.