Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Ajax > Unable to Export from rad scheduler to iCalender
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Not answered Unable to Export from rad scheduler to iCalender

Feed from this thread
  • Posted on Apr 28, 2011 (permalink)

    Hi there, 
    I am having issues with Export to iCalender from a rad 


    scheduler .
    Here is what i am doing ..
    I have a rad scheduler on one page , when i click on "Export" 


    Button , it actually opens a rad window where i have to select 


    either of the 2 options ,among which if i select the second 


    one , i have to export the stuff in shceduler to a csv file.
    What i did, 
    I kept the data in the scheduler in a Session before export is 


    clicked, and in the rad window i am giving this Session as 


    datasource to a rad scheduler and then trying to export the 


    data to a iCalender
    Code of what i did :
    in Parent.aspx
    -------------------------------------------------
     


    <telerik:RadButton ID="btnExport" runat="server" Text="Export" 


    CommandName="Export" OnClick="btnExport_Click">
    <Image EnableImageButton="true" />
    </telerik:RadButton>


    in Parent.cs
    --------------------------------------------------
     protected void btnExport_Click(object sender, EventArgs e)
        {
            RadWindow1.NavigateUrl = "Pages/OpenPopUp";
            RadWindow1.VisibleOnPageLoad = true;
           
        }


    In the Rad Window(OpenPopUp.aspx)
    --------------------------------------------------
    <telerik:RadMultiPage runat="server" ID="RadMultiPage1" 


    SelectedIndex="0" Width="450px">
                                        <telerik:RadPageView 


    runat="server" ID="RadPageView1" Height="130px">
                                            <div class="tab">
                                                


    <asp:RadioButtonList ID="rbtnSelect" runat="server" 


    RepeatDirection="Vertical"
                                                    TabIndex="1">
    <asp:ListItem Text="Export To Excel" Value="0" Selected="True" 


    />                                                
    <asp:ListItem Text="Export To iCaleder/Google Calender/Outlook 


    Calender" Value="1" />
                                                


    </asp:RadioButtonList>
     </div>
    </telerik:RadPageView>
    </telerik:RadMultiPage>




    <telerik:RadButton ID="btnpnlOK"  runat="server" Text="Ok" 
                                        OnClick="btnpnlOK_Click">
                                        <Image 


    IsBackgroundImage="true" EnableImageButton="true" />
                                    </telerik:RadButton>


    In the Rad Window(OpenPopUp.cs)
    --------------------------------------------------
      protected void Page_Load(object sender, EventArgs e)
        {
            #region AJAX Settings
            RadAjaxManager mgr = RadAjaxManager.GetCurrent(Page);
            mgr.AjaxSettings.Clear();
            mgr.AjaxSettings.AddAjaxSetting(mgr, pnlContent);
            mgr.AjaxSettings.AddAjaxSetting(btnpnlOK, pnlContent);
            #endregion
           
        }


     protected void btnpnlOK_Click(object sender, EventArgs e)
        {
     else //Export to iCalender/google calender/outlook calender
            {
                oDs.Tables.Add(oDt);
                DataView dv = oDs.Tables[0].DefaultView;
                DataTable dataTable = new DataTable();
                if (dv.Table.Rows.Count > 0)
                {
                    dataTable = dv.Table;
                    RadScheduler gvShcedule = new RadScheduler();
                    gvShcedule.DataSource = dataTable;
                    gvShcedule.DataKeyField = "ScheduleID";
                    gvShcedule.DataSubjectField = "Name";
                    gvShcedule.DataStartField = "FromDate";
                    gvShcedule.DataEndField = "ToDate";
                    gvShcedule.DataBind();
                    WriteCalendar(RadScheduler.ExportToICalendar


    (gvShcedule.Appointments));
                }
            }




     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

  • Veronica Veronica admin's avatar

    Posted on Apr 28, 2011 (permalink)

    Hi SHERFUDEEN A,

    I didn't understood your requirement. Unfortunately our RadScheduler don't have export to CSV files at that moment. As for the iCal export - do you have any trouble in exporting the scheduler or did you receive any errors?

    Could you please send me your full code in the attached .zip file so I can inspect it and help you?

    Thank you!

    All the best,
    Veronica Milcheva
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  • Posted on Apr 29, 2011 (permalink)

    Hi , 
    Got it sorted out , 
    Everything is working fine now .
    Thank you very much

  • Veronica Veronica admin's avatar

    Posted on Apr 29, 2011 (permalink)

    Hello SHERFUDEEN A,

    I am glad that you solved the issue on your own.

    Please feel free to ask me if you have further questions.

    Kind regards,
    Veronica Milcheva
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  • Posted on Apr 29, 2011 (permalink)

    Hi there , 
    Encountered with an issue here. As i mentioned above , i have to export to excel from a rad grid .
    I am doing this in a rad window. 
    I have a master page where i have Ajax Manager and in the content page i have written the onRequestStart  as follows
      RadAjaxManager mgr = RadAjaxManager.GetCurrent(Page);
            mgr.AjaxSettings.Clear();
            mgr.AjaxSettings.AddAjaxSetting(mgr, pnlContent);
            mgr.AjaxSettings.AddAjaxSetting(btnpnlOK, pnlContent);
            mgr.ClientEvents.OnRequestStart = "RequestStart";
    and in the master page i handled this as
     function RequestStart(sender, args) {
                    if (args.EventTarget.indexOf('btnExport') != -1) {
                        args.EnableAjax = false;
                    }
                }
    Here btnExport is the actual button when i click export should be done .
    The file is exported perfect , and i can download the file but the ajax loading image keeps loading and the rad window does not close.
    Atter the export functionality in the button click event , i wrote like this to close the window , 
    RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "close", "<script language='javascript'> cancelAndClose();</script>", false);
    But it would not close and the loading image does not go 

    Thanks and Regards

  • Veronica Veronica admin's avatar

    Posted on Apr 29, 2011 (permalink)

    Hi SHERFUDEEN A,

    I am confused now. Your Ticket subject is referring export of the RadScheduler and in your previous post you are telling about RadGrid. Could you please send me your code so I can inspect it and help you?

    Thank you!

    All the best,
    Veronica Milcheva
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  • Posted on Apr 29, 2011 (permalink)

    Hi , 
    SInce there is no direct way to export to excel from a rad scheduler , i am binding the same data to a Rad grid to export it to Excel.

  • Veronica Veronica admin's avatar

    Posted on Apr 29, 2011 (permalink)

    Hello SHERFUDEEN A,

    Yes, it is more clear now. Thanks for the clarification. Could you please send me your code so I can inspect it and help you?

    All the best,
    Veronica Milcheva
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  • Posted on Apr 29, 2011 (permalink)

    Hi,
    Following is the code and ajax manager in Master page:
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableAJAX="true"  >
            <ClientEvents />
            </telerik:RadAjaxManager>
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server" Skin="Vista"
                BackgroundPosition="Center" EnableEmbeddedSkins="true" MinDisplayTime="100" ZIndex="9999" InitialDelayTime="0" />
            <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel2"
                EnableAJAX="true">
                <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
                </asp:ContentPlaceHolder>
            </telerik:RadAjaxPanel>

    In the Content page (.aspx)

    <telerik:RadButton ID="btnExport" runat="server" Text="Export"
                            CommandName="Export" OnClick="btnExport_Click">                           
                            </telerik:RadButton>
    In ContentPage(.cs)

    protected void btnExport_Click(object sender, EventArgs e)
        {
            RadWindow1.Title = "Export Schedule";
            RadWindow1.NavigateUrl = "Pages/ExportPopUp";
            RadWindow1.VisibleOnPageLoad = true;
        }

    In ExportPopUp(.aspx)
     <script type="text/javascript">
                function GetRadWindow() {
                    var oWindow = null;
                    if (window.radWindow) oWindow = window.radWindow;
                    else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
                    return oWindow;
                }
                function cancelAndClose() {
                    var oWindow = GetRadWindow();
                    oWindow.argument = null;
                    oWindow.close();
                }
                function RequestStart(sender, args) {
                    if (args.EventTarget.indexOf('btnpnlOK') != -1) {
                        args.EnableAjax = false;
                    }
                }          
            </script>

     <telerik:RadButton ID="btnpnlOK" TabIndex="2" runat="server" Text="Ok" 
                                        OnClick="btnpnlOK_Click" >                                    
     </telerik:RadButton>
    In ExportPopUp(.cs)
     protected void Page_Load(object sender, EventArgs e)
        {
            #region Ajax Settings
            RadAjaxManager mgr = RadAjaxManager.GetCurrent(Page);
            mgr.AjaxSettings.Clear();
            mgr.AjaxSettings.AddAjaxSetting(mgr, pnlContent);
            mgr.AjaxSettings.AddAjaxSetting(btnpnlOK, pnlContent);
            mgr.ClientEvents.OnRequestStart = "RequestStart";
            #endregion      
        }

    protected void btnpnlOK_Click(object sender, EventArgs e)
        {
     DataView dv = oDs.Tables[0].DefaultView; // I Have the data in oDs
                    DataTable dataTable = new DataTable();
                    if (dv.Table.Rows.Count > 0)
                    {
                        dataTable = dv.Table;                    
                        RadGrid gvShcedule = new RadGrid();
                        this.Page.Controls.Add(gvShcedule);
                        gvShcedule.DataSource = dataTable;                  
                        gvShcedule.DataBind();                    
                        gvShcedule.MasterTableView.ExportToExcel();
                        gvShcedule.ExportSettings.FileName = "RadGridExportToExcel";                 
                    }
    RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "close", "<script language='javascript'> cancelAndClose();</script>", false);
    }

    Now the file is downloading fine , but the rad window does not close , the ajax image keeps loading and loading 

    Thanks and regards
                                   

  • Posted on May 3, 2011 (permalink)

    Hi, 
    Issue has been sorted , Thanks

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Ajax > Unable to Export from rad scheduler to iCalender