This project is read-only.

Progressbar in ASP.Net - Help (Chrome)

Oct 25, 2011 at 12:38 PM
Edited Oct 27, 2011 at 5:53 PM


Based on an example in VB ( I wrote a routine to generate progress bar in ASP.Net. The problem is that this page is not working with Chrome.
Please can someone help me.
Thank you.

The Code...



<%@ Page  EnableSessionState="False" Language="vb" AutoEventWireup="false" CodeBehind="progressbar.aspx.vb" Inherits="IonicZip.progressbar" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head id="Head1" runat="server">
    <title>Zipping Wait...</title>
    <link href="progressbar.css" rel="stylesheet" type="text/css" />
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    <asp:Timer ID="TimerPROGRESS" runat="server" Interval="1000" OnTick="infoProgressBar" />
    <asp:Panel ID="panel_geracao" runat="server">
        <asp:HiddenField ID="hiddenPROGRESS" Value="0%" runat="server" />
       <div id="progressBox">
          <asp:UpdatePanel ID="panelUPDATE" runat="server">
                    <asp:AsyncPostBackTrigger controlid="TimerPROGRESS" eventname="Tick" />

                    <div id="progressbar">
                        <div class="text"><%=hiddenPROGRESS.value%></div>
                        <div style="width: <%=hiddenPROGRESS.value%>" class="progress">
                            <span style="WIDTH: 352px" class="text"><%= hiddenPROGRESS.Value%></span>

                    <p><asp:Literal ID="litStatus" Text="" runat="server"></asp:Literal></p>
                    <p><asp:Literal ID="litPFiles" Text="" runat="server"></asp:Literal></p>
                    <p><asp:LinkButton ID="lkCancelar" runat="server">Cancel</asp:LinkButton></p>
                    <p><asp:Literal ID="Literal1" runat="server"></asp:Literal></p>

            <br />
            <asp:Button ID="Button1" runat="server" Text="Start" />                         




Imports System.Text
Imports System.IO
Imports Ionic.Zip
Imports System.Collections.Generic
Imports System.Threading

Public Class progressbar
    Inherits System.Web.UI.Page

    Private Shared progressStart As Boolean = False
    Private Shared progressComplete As Boolean = False
    Private Shared progressCancel As Boolean = False

    Private Shared progressCurrentFile As String = ""
    Private Shared progressPFile As Double = 0
    Private Shared progressPTotal As Double = 0
    Private Shared progressCFile As Integer = 0
    Private Shared progressTFile As Integer = 0

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Public Sub TimerPROGRESS_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TimerPROGRESS.Tick

        Literal1.Text = FormatDateTime(Now(), DateFormat.LongTime)

    End Sub

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click


    End Sub

    Private Sub lkCancelar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lkCancelar.Click

        progressCancel = True

    End Sub

    Public Sub infoProgressBar()

        Dim percTotal As String
        Dim percFile As String

        If progressStart = False And progressComplete = False Then

            litStatus.Text = "Wait..."


            percTotal = String.Format("{0:N0}%", progressPTotal)
            percFile = String.Format("{0:N0}%", progressPFile)

            litStatus.Text = progressCurrentFile
            litPFiles.Text = progressCFile & " de " & progressTFile & " arquivos (" & percFile & ")"

            hiddenPROGRESS.Value = percTotal

        End If

        If progressComplete = True Then

            litStatus.Text = "Finish"
            litPFiles.Text = ""
            hiddenPROGRESS.Value = "100%"
            TimerPROGRESS.Enabled = False

        End If

        'If progressStart = False Then
        '    ZipUp()
        'End If

    End Sub

    Public Shared Sub ZipUp()

        Using zip As ZipFile = New ZipFile

            AddHandler zip.SaveProgress, AddressOf ZIPSaveProgress
            AddHandler zip.SaveProgress, AddressOf ZIPCancel

            zip.TempFileFolder = "D:\"
            zip.Save("D:\zip_" & Now.ToString("yyyyMMdd_HHmmss") & ".zip")

        End Using

    End Sub

    Public Shared Sub ZIPSaveProgress(ByVal sender As Object, ByVal e As SaveProgressEventArgs)

        ' ZipProgressEventType

        If (e.EventType = ZipProgressEventType.Saving_Started) Then
            progressStart = True

        ElseIf (e.EventType = ZipProgressEventType.Saving_Completed) Then
            progressComplete = True

        ElseIf (e.EventType = ZipProgressEventType.Saving_BeforeWriteEntry) Then
            progressCurrentFile = e.CurrentEntry.FileName
            progressCFile = e.EntriesSaved
            progressTFile = e.EntriesTotal
            progressPTotal = CDbl(progressCFile) / (0.01 * progressTFile)

        ElseIf (e.EventType = ZipProgressEventType.Saving_EntryBytesRead) Then
            progressPFile = CDbl(e.BytesTransferred) / (0.01 * e.TotalBytesToTransfer)

        End If

    End Sub

    Public Shared Sub ZIPCancel(ByVal sender As Object, ByVal e As SaveProgressEventArgs)

        If progressCancel = True Then
            e.Cancel = True
        End If

    End Sub

End Class




    font-family: Arial, Helvetica, sans-serif;
    font-size: 10px;
    color: #333333;
    background-color: #F1F1F1;

    margin-right: auto;
    margin-left: auto;
    width: 390px;
    padding-top: 45px;
    background-repeat: no-repeat;
    font-family: Arial, Helvetica, sans-serif;
    background-color: #EFEFEF;
    background-image: url('progressbar-base.jpg');
    background-position: left top;  
#progressBox p
    font-size: 10px;
    color: #666666;
    text-align: center;
    float: none;

#progressBox a
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #333333;
    text-decoration: none;

#progressBox a:hover
    text-decoration: underline;

#progressBox h1
    width: 100%;
    height: 60px;
    font-size: 12px;
    color: #666666;
    text-align: center;
    line-height: 18px;
    background-color: #DFDFDF;
    padding: 15px 10px 0px 10px;

#progressBox p.descricao
    font-size: 10px;
    color: #666666;
    text-align: center;
    line-height: 14px;
    text-transform: uppercase;

/* progress bar container */
    width: 352px;
    height: 28px;
    position: relative;
    color: #434343;
    font-size: 22px;
    margin-left: 20px;
/* color bar */
#progressbar div.progress       
    background-position: left top;
    position: absolute;
    width: 0;
    height: 100%;
    overflow: hidden;
    background-color: #434343;
/* text on bar */
#progressbar div.progress .text       
    position: absolute;
    text-align: center;
    color: white;           
/* text off bar */
#progressbar div.text       


Nov 7, 2011 at 5:16 PM

I can't help you with the information you've given.

you said "it's not working".  The one additional item of information you provided is "in Chrome."  That's not enough for me to help diagnose the problem.

You'll need to be more specific about what "not working" means.