[CLOSED] DirectEvent File Download plus MaskEdit issue

  1. #1

    [CLOSED] DirectEvent File Download plus MaskEdit issue

    Hi folks,

    Based with example http://forums.ext.net/showthread.php...ll=6#post49277 I'm into an issue.

    My code is

                        <ext:MenuItem ID="menuPDF" runat="server" IconCls="MyIcon_PDF" Text="Exportar a PDF">
                            <DirectEvents>
                                <Click OnEvent="menuPDF_Click" AutoDataBind="true" FormID="form1" Buffer="300" IsUpload="true" Method="GET">
                                    <EventMask ShowMask="true" />
                                </Click>
                            </DirectEvents>
                        </ext:MenuItem>
    The issue is just before IE dialog's Open / Save as appears I should hide the EventMask. How can I hidde/stop EventMask message?

    Cheers

    Appologize guys. I found this


    Appologize guys. I have found this thread
    http://forums.ext.net/showthread.php...ll=1#post75176 and hidde mask is not possible. I will disable it.

    Please close this issue.

    Thanks a lot
    Last edited by Daniil; Jun 11, 2012 at 2:08 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Yes, you have found the post which, generally, answers your question.

    But I will tell about an approach which my colleague has used.

    He also needs a mask for AJAX downloading a report which takes a lot of server time to be built.

    So, he fires a DirectEvent/DirectMethod with a mask to make a report. Not actual downloading, just building the report and saving on server. Then in a Success handler of that DirectEvent/DirectMethod he makes another request to download, certainly, without a mask. But it doesn't take too much time to just download.

    Maybe, this approach will suite your needs as well.
  3. #3
    Daniil,

    thanks a lot for your answer. After apply your [DirectMethod] I'm getting a 200 Bad Request Syntax error. This is the code.

    Please may you help me?

    Cheers

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="extnet_proves.Default" %>
    
    <%@ Import Namespace="System.Collections.Generic" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
    
        protected void Button1_Click(object sender, DirectEventArgs e)
        {
            //sleep for testing
            System.Threading.Thread.Sleep(2000);
        }
    
        [DirectMethod]
        public void Download()
        {
            System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
            oStringWriter.WriteLine("Hello world");
    
            Response.Clear();
            Response.ClearContent();
            Response.ClearHeaders();
            Response.AddHeader("Content-Disposition", "attachment; filename=TEST.TXT");
            Response.ContentType = "text/plain";
            Response.Write(oStringWriter);
            Response.End();
        }
    </script>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title></title>
    </head>
    <body>
        <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:Button ID="Button1" runat="server" Icon="PageExcel" Scale="Medium" Text="Export"
            Width="90">
            <DirectEvents>
                <Click OnEvent="Button1_Click" AutoDataBind="true" FormID="Form1" Buffer="300" IsUpload="true" Method="GET"
                    Success="Ext.net.DirectMethods.Download();">
                    <EventMask ShowMask="true" />
                </Click>
            </DirectEvents>
        </ext:Button>
        </form>
    </body>
    </html>
  4. #4
    I think you should pass
    isUpload : true
    to a DirectMethod.

    Example
    Ext.net.DirectMethods.Download({
        isUpload : true
    });
    Also there is no need to set up
    IsUpload="true"
    and, probably,
    FormID="Form1"
    for the Click DirectEvent since there is no actual download during that DirectEvent.

    P.S. By the way, you could replace
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="extnet_proves.Default" %>
    with just
    <%@ Page Language="C#" %>
    when posting an example on the forums.

    It will allow us to just copy, paste and run your examples. Now we have to remove it manually each time.

    Not a big deal, but it would make our lives a bit easier:)
  5. #5
    Daniil,

    thanks a lot for your help. Now it works fine.

    My apologies about
    <%@ Page Language="C#"
    directive.

    Cheers!
    Last edited by Daniil; Jun 11, 2012 at 2:05 PM. Reason: Please use [CODE] tags
  6. #6
    Quote Originally Posted by digitek View Post
    My apologies about
    <%@ Page Language="C#"
    directive.
    No problem at all! Just a minor note.

    You post good examples, thanks for that.

Similar Threads

  1. [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
  2. [CLOSED] [1.0] DirectEvent File Download
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jan 21, 2011, 6:04 PM
  3. [CLOSED] [1.0] MVC Download file
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 02, 2010, 11:10 AM
  4. [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
  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