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">
                <telerik:AjaxSetting AjaxControlID="paRequestListView">
                        <telerik:AjaxUpdatedControl ControlID="paRequestListView" LoadingPanelID="raLoadingPanel"></telerik:AjaxUpdatedControl>
        <asp:Panel ID="paRequestListView" runat="server">
             <NMHG:RequestListView id="RequestListView" runat="server"></NMHG:RequestListView>

    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.ContentType = "text/plain";
                    response.AddHeader("Content-Disposition", "attachment; filename=" + RequestDownloadFileName + ";");
                    response.TransmitFile(ConfigurationManager.AppSettings.Get("Download directory") + RequestDownloadFileName);

    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.



  2. Maria Ilieva
    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:

    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