[CLOSED] TaskManager and FileUploadField don't work together correctly

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] TaskManager and FileUploadField don't work together correctly

    Hello,
    I want to use TaskManager and FileUploadField on the same page.
    Unfortunately the page reloads continuously and crashes und Chrome or Firefox.
    How can I do this?
    Thanks

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="DCx.DeltaConsoExpert.WebForm3" %>
    
    <%@ Import Namespace="System.Threading" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!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>ProgressBar - Ext.NET Examples</title>
        <link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
        <script runat="server">
            protected void UploadClick(object sender, DirectEventArgs e)
            {
            }
    
            protected void StartLongAction(object sender, DirectEventArgs e)
            {
                this.Session["LongActionProgress"] = 0;
                ThreadPool.QueueUserWorkItem(LongAction);
    
                ResourceManager1.AddScript("{0}.startTask('longactionprogress');", TaskManager1.ClientID);
            }
    
            private void LongAction(object state)
            {
                for (int i = 0; i < 10; i++)
                {
                    Thread.Sleep(1000);
                    this.Session["LongActionProgress"] = i + 1;
                }
    
                this.Session.Remove("LongActionProgress");
            }
    
            protected void RefreshProgress(object sender, DirectEventArgs e)
            {
                object progress = this.Session["LongActionProgress"];
    
                if (progress != null)
                {
                    Progress1.UpdateProgress(((int)progress) / 10f, string.Format("Step {0} of {1}...", progress.ToString(), 10));
                }
                else
                {
                    ResourceManager1.AddScript("{0}.stopTask('longactionprogress');", TaskManager1.ClientID);
                    Progress1.UpdateProgress(1, "All finished!");
                }
            }
        </script>
    </head>
    <body>
        <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <h1>
            Progress Bar</h1>
        <p>
            The example shows how to update the ProgressBar during long server-side actions.</p>
        <ext:ProgressBar ID="Progress1" runat="server" Width="300" />
        <ext:TaskManager ID="TaskManager1" runat="server">
            <Tasks>
                <ext:Task TaskID="longactionprogress" Interval="1000" AutoRun="false">
                    <DirectEvents>
                        <Update OnEvent="RefreshProgress" />
                    </DirectEvents>
                </ext:Task>
            </Tasks>
        </ext:TaskManager>
        <ext:Panel ID="Form" runat="server" Width="600" Frame="true" AutoHeight="true" PaddingSummary="10px 10px 0 10px"
            LabelWidth="50" ButtonAlign="Center">
            <Items>
                <ext:FileUploadField ID="FileUploadField1" runat="server" AnchorHorizontal="100%"
                    EmptyText="Selectionner un fichier..." FieldLabel="Fichier" ButtonText="" Icon="ImageAdd">
                    <DirectEvents>
                        <FileSelected OnEvent="UploadClick" />
                    </DirectEvents>
                </ext:FileUploadField>
            </Items>
    
            <Buttons>
                <ext:Button ID="ImportButton" runat="server" Text="Importation">
                    <DirectEvents>
                        <Click OnEvent="StartLongAction" />
                    </DirectEvents>
                </ext:Button>
            </Buttons>
        </ext:Panel>
        </form>
    </body>
    </html>
    Last edited by Daniil; Oct 14, 2011 at 10:11 AM. Reason: [CLOSED]

Similar Threads

  1. [CLOSED] FileUploadField doesn't work as should
    By ViDom in forum 1.x Legacy Premium Help
    Replies: 23
    Last Post: Jul 16, 2012, 4:40 PM
  2. Replies: 2
    Last Post: Jun 19, 2012, 1:19 PM
  3. Replies: 7
    Last Post: Mar 28, 2011, 4:51 PM
  4. [CLOSED] TaskManager
    By majestic in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 12, 2009, 7:27 AM
  5. FileUploadField can't work
    By Fresh.Killer in forum 1.x Help
    Replies: 1
    Last Post: Dec 07, 2009, 8:26 AM

Tags for this Thread

Posting Permissions