This project has moved and is read-only. For the latest updates, please go here.

progressebar only appears at the end of the process!!

Aug 22, 2011 at 8:38 PM

hi, I'm trying to use the progressbar control multifilament.
but the progress bar appears only appears at the end of the process ...
follows the code.

 

    <div>
        <Upload:ProgressBar ID="ProgressBar1" runat="server" AllowTransparency="False" Inline="True" Width="553px"/>
        <Upload:MultiFile ID="MultiFile1" runat="server">
        </Upload:MultiFile>
        <br />
        <asp:Button ID="btnUpload" runat="server" Text="Upload All" />
    </div>

    protected void Page_Load(object sender, EventArgs e)
    {
        ProgressBar1.AddTrigger(btnUpload);
        this.PreRender += new EventHandler(Page_PreRender);
    }

    private void Page_PreRender(object sender, EventArgs e)
    {
        if (this.IsPostBack)
        {
            try
            {
                UploadedFile[] hfc = MultiFile1.Files;
                for (int i = 0; i < hfc.Count(); i++)
                {
                    UploadedFile hpf = hfc[i];
                    if (hpf.ContentLength > 0)
                        hpf.SaveAs(Server.MapPath("MyFiles") + "\\" + System.IO.Path.GetFileName(hpf.FileName));

                }
            }
            catch (Exception ex)
            {

            }
        }
    }