RadToolBar with Download file

8 posts, 0 answers
  1. Lei
    Lei avatar
    7 posts
    Member since:
    Sep 2007

    Posted 06 May 2008 Link to this post

    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

  2. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 09 May 2008 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Lei
    Lei avatar
    7 posts
    Member since:
    Sep 2007

    Posted 10 Jun 2008 Link to this post

    I just applied the offical service pack, but the problem is stilll occurred. Is that problem fixed by the service pack?
  5. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 11 Jun 2008 Link to this post

    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
  6. Lei
    Lei avatar
    7 posts
    Member since:
    Sep 2007

    Posted 11 Jun 2008 Link to this post

    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
  7. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 13 Jun 2008 Link to this post

    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
  8. David Cowan
    David Cowan avatar
    22 posts
    Member since:
    Nov 2009

    Posted 23 Jul 2012 Link to this post

    Any update on this?
  9. Kate
    Admin
    Kate avatar
    1898 posts

    Posted 25 Jul 2012 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017