[CLOSED] [1.0] DirectEvent File Download

  1. #1

    [CLOSED] [1.0] DirectEvent File Download

    Hello,

    I have the following example:

    Parent.aspx:
        <ext:Button runat="server"
            Icon="PageExcel"
            Scale="Medium"
            Text="Export"
            Width="90">
            <DirectEvents>
                <Click
                    AutoDataBind="true"
                    Buffer="300"
                    IsUpload="true"
                    Method="GET"
                    Url="/Module/Tenders/Example.aspx" />
            </DirectEvents>
        </ext:Button>
    Example.aspx.cx
                Response.Clear();
                Response.AddHeader("Content-Disposition", "attachment; filename=test.txt");
                Response.ContentType = "text/plain";
                Response.Write("Hello World");
                Response.End();
    When I click on the "Export" button it throws an error.

    Suggestions?

    Cheers,
    Timothy
    Last edited by Daniil; Jan 22, 2011 at 3:59 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Is the button placed inside form?
    IsUpload mode requires a form to upload a file
  3. #3
    Nope this is in MVC and I cant use a regular anchor because I have extra parameters to pass in my more complicated solution.

    Cheers
  4. #4
    Hi,

    But your FileUploadField is placed inside form, isn't it? Just set id of that form to FormID property for DirectEvent
  5. #5
    I don't have a FileUpload field on my page; just a button that I was hoping to click and download a file from the server (Example.aspx.cs). I thought I had to have IsFile="true" to be able to download the file in a DirectEvent.

    I do not have a <form> on my application.

    Cheers
  6. #6
    Hi,

    Ah, sorry, I missed that you download instead upload.
    In any way, form is required to download file via ajax.
    You can create hidden form and use it to download a file

    <form id="fileform" class="x-hide-display">
    </form>
    
    <ext:Button runat="server"
        Icon="PageExcel"
        Scale="Medium"
        Text="Export"
        Width="90">
        <DirectEvents>
            <Click
                AutoDataBind="true"
                FormID="fileform"
                Buffer="300"
                IsUpload="true"
                Method="GET"
                Url="/Module/Tenders/Example.aspx" />
        </DirectEvents>
    </ext:Button>
    Also, I am not sure but Method="GET" cannot be used with IsUpload (as I remember, POST will be forced)
  7. #7
    That worked thank you!

    Cheers,
    Timothy

Similar Threads

  1. [CLOSED] DirectEvent File Download plus MaskEdit issue
    By digitek in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Jun 11, 2012, 2:08 PM
  2. [CLOSED] How to download a file in DirectEvent?
    By vadym.f in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jun 08, 2012, 1:20 PM
  3. [CLOSED] [1.0] - MVC - DirectEvent Download File
    By drkoh in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 23, 2010, 8:26 PM
  4. [CLOSED] Download a file in an MVC app
    By Stefanaccio in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 02, 2010, 9:01 PM
  5. [CLOSED] [1.0] File download in MVC
    By tdracz in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 23, 2009, 4:43 PM

Tags for this Thread

Posting Permissions