RadListView + AJAX + Download file

2 posts, 0 answers
  1. Marcel
    Marcel avatar
    8 posts
    Member since:
    Dec 2012

    Posted 22 Jan 2013 Link to this post

    Hi there,

    I have a problem in using the radListView with AJAX.

    As you can see in the enclosed image I want the user be able to download a file. (radlistview.png)
    When I enable AJAX an error occurs (error.png).
    I use the following code:

    <
    asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
           
        <telerik:RadAjaxManagerProxy ID="rampRequest" runat="server">
            <AjaxSettings>  
                <telerik:AjaxSetting AjaxControlID="paRequestListView">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="paRequestListView" LoadingPanelID="raLoadingPanel"></telerik:AjaxUpdatedControl>
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManagerProxy>
           
        <asp:Panel ID="paRequestListView" runat="server">
             <NMHG:RequestListView id="RequestListView" runat="server"></NMHG:RequestListView>
        </asp:Panel>
         
    </asp:Content>

    protected void rlvRequest_ItemCommand(object source, RadListViewCommandEventArgs e)
            {
                //Download file
                if (e.CommandName == "Download")
                {
                    //show save as dialog
                    System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
                    response.ClearContent();
                    response.Clear();
                    response.ContentType = "text/plain";
                    response.AddHeader("Content-Disposition", "attachment; filename=" + RequestDownloadFileName + ";");
                    response.TransmitFile(ConfigurationManager.AppSettings.Get("Download directory") + RequestDownloadFileName);
                    response.End();
                }
            }


    When I remove the <telerik:RadAjaxManagerProxy> tag from the code above i am able to download the file.
    Any idea why my download not works when AJAX is enabled?

    I also noticed the LoadingPanel for my RadListView is never shown. AJAX functions normal in my RadListView.
    I use the same code for my RadGrids were the LoadingPanel is shown.


    Regards,

    Marcel

  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 25 Jan 2013 Link to this post

    Hi Marcel,

    I would suggest you to review the help topic below which elaborates on downloading files with Ajax:
    http://www.telerik.com/help/aspnet-ajax/ajax-download.html

    I hope this helps.


    Kind regards,
    Maria Ilieva
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top