This is a migrated thread and some comments may be shown as answers.

RadListView + AJAX + Download file

1 Answer 70 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Marcel
Top achievements
Rank 1
Marcel asked on 22 Jan 2013, 02:17 PM
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

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 25 Jan 2013, 02:26 PM
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.
Tags
Ajax
Asked by
Marcel
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or