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

RadToolBar with Download file

7 Answers 95 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Lei
Top achievements
Rank 2
Lei asked on 06 May 2008, 04:27 PM
I'm using RadToolBar to create some RadToolBarButtons for user to download file from the file system. For example, one button for user to download Excel version user guide and the other version for user to donwload PDF version user guide. The program work fine under IE, but the program can not be run under Firefox. When the user using Firefox to access such webpage, first time he/she clicked RadToolBarButton to download PDF version user guide, after that, the entire became non-functional. No any effect after the Excel button is clicked.
My project is quite simple and contains one webform only. Here is my code
--------------- Default.aspx ------------------------------------

<%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<%@ Register Assembly="Telerik.Web.UI, Version=2008.1.415.20, Culture=neutral, PublicKeyToken=121fae78165ba3d4"
    Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <div>
            <telerik:RadToolBar ID="RadToolBar1" runat="server">
                <CollapseAnimation Duration="200" Type="OutQuint" />
                <Items>
                    <telerik:RadToolBarButton runat="server" Text="Download Excel" Value="DOWNLOADEXCEL">
                    </telerik:RadToolBarButton>
                    <telerik:RadToolBarButton runat="server" Text="Download PDF" Value="DOWNLOADPDF">
                    </telerik:RadToolBarButton>
                </Items>
            </telerik:RadToolBar>
        </div>
    </form>
</body>
</html>
------------------------------------------------------------------------
---------------Default.aspx.vb--------------------------------------------

Partial Class _Default
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub RadToolBar1_ButtonClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadToolBarEventArgs) Handles RadToolBar1.ButtonClick
        If e.Item.Value = "DOWNLOADEXCEL" Then
            Dim file As System.IO.FileInfo = New System.IO.FileInfo("C:\Test.jpg")
            Response.Clear()
            Response.AddHeader("Content-Disposition", "attachment; filename=" & file.Name)
            Response.AddHeader("Content-Length", file.Length.ToString())
            Response.ContentType = "application/octet-stream"
            Response.WriteFile(file.FullName)
            Response.End() 'if file does not exist
        Else
            Dim file As System.IO.FileInfo = New System.IO.FileInfo("C:\Test.png")
            Response.Clear()
            Response.AddHeader("Content-Disposition", "attachment; filename=" & file.Name)
            Response.AddHeader("Content-Length", file.Length.ToString())
            Response.ContentType = "application/octet-stream"
            Response.WriteFile(file.FullName)
            Response.End() 'if file does not exist
        End If
    End Sub
End Class
------------------------------------------------------------------------
Please help me how to solve this problem.

Thanks & Regards,
Louis

7 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 09 May 2008, 04:15 PM
Hello Lei,

This is a well known problem to us and we are currently working on it. Hopefully, the fix will be included in the official Service Pack of the RadControls for ASP.NET Ajax suite, scheduled for about the mid of the next week.

For now, I suggest you use the following workaround: put the 'file emitting' code and only it in the Page_Load method of a new page; whenever you would like to emit the file to the user you should redirect to this new page on the client.

I have attached a simple project to illustrate the approach I described above.


All the best,
Simon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Lei
Top achievements
Rank 2
answered on 10 Jun 2008, 09:51 AM
I just applied the offical service pack, but the problem is stilll occurred. Is that problem fixed by the service pack?
0
Simon
Telerik team
answered on 11 Jun 2008, 07:31 AM
Hello Lei,

We managed to fix the problem but after the official Service Pack release.

I have attached our latest internal build to this post for your convenience.

Please download it and try it out.

Kind regards,
Simon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Lei
Top achievements
Rank 2
answered on 11 Jun 2008, 08:36 AM
Hi,

   I just applied the hot fix but the problem seems cannot be fixed. The whole web form became non-functional when the user using Firefox. Is there any comment?

Thanks & Regards,
Louis Lei
0
Simon
Telerik team
answered on 13 Jun 2008, 02:11 PM
Hi Lei,

Yes, actually, in the hotfix I posted this problem is not resolved, yet. I consulted once again with our developers and it seems that the problem is resolved for RadComboBox only.

We will do our best, however, to fix the issue in the upcoming Service Pack 2 due to the end of the next week.

Please accept my apologies for misguiding you.

All the best,
Simon
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
David Cowan
Top achievements
Rank 1
answered on 23 Jul 2012, 07:21 PM
Any update on this?
0
Kate
Telerik team
answered on 25 Jul 2012, 12:22 PM
Hello David,

I noticed that the last post in the forum is quite old and I believe that you refer to an old version of our controls as well. Please note that we no longer provide support for this version as explained in our Support Lifecycle policy here. I would, however, suggest that you try using the latest version of the Telerik controls and see how it goes.

Kind regards,
Kate
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
ToolBar
Asked by
Lei
Top achievements
Rank 2
Answers by
Simon
Telerik team
Lei
Top achievements
Rank 2
David Cowan
Top achievements
Rank 1
Kate
Telerik team
Share this question
or