Welcome Guest Search | Active Topics | Sign In | Register

Change Maximum value for a progressbar when runTask starts Options
Philipp Jenni
Posted: Sunday, September 23, 2007 10:35:54 AM
Rank: Advanced Member
Groups: Member

Joined: 6/9/2007
Posts: 98
How i can change the maximum property when i use the server side progressbar
example? I create a recordset in the runtask method, and makes a for each loop. I know the
number of record only in this method, so want set a correct maximum value. But the control doesn't refresh the value.

Can you add a new function setMaxium to the Client API for the ProgressBar Object.
So i can add a Client Script to my page where correct the value.

Or have you another solution?

Here my example page:

ASPX:

Code: HTML/ASPX
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Test.aspx.vb" Inherits="Test" Debug="true" %>
<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>

<!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 runat="server">
    <title>My TestPage</title>
    
   
</head>
<body>
    <form id="form1" runat="server">
    <div>
         <eo:ProgressBar ID="ProgressBar1" runat="server" BackgroundImage="00060101"
            BackgroundImageLeft="00060102" BackgroundImageRight="00060103" ControlSkinID="None"
            IndicatorImage="00060104" IndicatorIncrement="7" ShowPercentage="True" StartTaskButton="Button1"
            Value="30" Width="250px">
        </eo:ProgressBar>
    </div>
        <asp:Button ID="Button1" runat="server" Text="Button" />
    </form>
</body>
</html>


VBS Code

Code: Visual Basic.NET
Partial Class Test
    Inherits System.Web.UI.Page



    Protected Sub ProgressBar1_RunTask(ByVal sender As Object, ByVal e As EO.Web.ProgressTaskEventArgs) Handles ProgressBar1.RunTask
        ProgressBar1.Maximum = 150

        Dim i As Integer
        For i = 0 To 150
            'Stop the task as soon as we can if the user has
            'stopped it from the client side
            If e.IsStopped Then
                Exit For
            End If

            'Here we call Thread.Sleep just for demonstration
            'purpose. You should replace this with code that
            'performs your long running task.
            System.Threading.Thread.Sleep(100)

            'You should frequently call UpdateProgress in order
            'to notify the client about the current progress
            e.UpdateProgress(i)
        Next i

    End Sub


End Class



thanks philipp
eo_support
Posted: Sunday, September 23, 2007 11:10:56 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You won't be able to do that. The only thing you can do in RunTask is to update the progess. In fact you rarely need to change the maximum value. Just prorate the progress value based on the maximum value. For example, you can always set the max value to 100 and then call UpdteProgress based on the correct percentage value.

Thanks
Philipp Jenni
Posted: Sunday, September 23, 2007 11:23:27 AM
Rank: Advanced Member
Groups: Member

Joined: 6/9/2007
Posts: 98
Oh, good idea. The Solution would be sometimes very simple; -)

Thanks philipp
Philipp Jenni
Posted: Sunday, September 23, 2007 12:46:40 PM
Rank: Advanced Member
Groups: Member

Joined: 6/9/2007
Posts: 98
In my Testpage is a new problem. When i have 2 Progressbars with 2 buttons, than i have a javascript error when i click on button1, wait to the job is finished and than i click on button2.

Here my ASPX Code

Code: HTML/ASPX
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Test.aspx.vb" Inherits="Test" Debug="true" %>
<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>

<!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 runat="server">
    <title>My TestPage</title>
    
   
</head>
<body>
    <form id="form1" runat="server">
    <div>
         <eo:ProgressBar ID="ProgressBar1" runat="server" BackgroundImage="00060101"
            BackgroundImageLeft="00060102" BackgroundImageRight="00060103" ControlSkinID="None"
            IndicatorImage="00060104" IndicatorIncrement="7" ShowPercentage="True" StartTaskButton="Button1"
            Value="30" Width="250px">
        </eo:ProgressBar>
    </div>
        <asp:Button ID="Button1" runat="server" Text="Button" /><eo:ProgressBar ID="ProgressBar2" runat="server" BackgroundImage="00060101"
            BackgroundImageLeft="00060102" BackgroundImageRight="00060103" ControlSkinID="None"
            IndicatorImage="00060104" IndicatorIncrement="7" ShowPercentage="True" StartTaskButton="Button2"
            Value="30" Width="250px">
        </eo:ProgressBar>
        <asp:Button ID="Button2" runat="server" Text="Button" />
    </form>
</body>
</html>


and my VB Code


Code: Visual Basic.NET
Partial Class Test
    Inherits System.Web.UI.Page



    Protected Sub ProgressBar1_RunTask(ByVal sender As Object, ByVal e As EO.Web.ProgressTaskEventArgs) Handles ProgressBar1.RunTask
        ProgressBar1.Maximum = 150

        Dim i As Integer
        For i = 0 To 150
            'Stop the task as soon as we can if the user has
            'stopped it from the client side
            If e.IsStopped Then
                Exit For
            End If

            'Here we call Thread.Sleep just for demonstration
            'purpose. You should replace this with code that
            'performs your long running task.
            System.Threading.Thread.Sleep(100)

            'You should frequently call UpdateProgress in order
            'to notify the client about the current progress
            e.UpdateProgress(i)
        Next i

    End Sub


    Protected Sub ProgressBar2_RunTask(ByVal sender As Object, ByVal e As EO.Web.ProgressTaskEventArgs) Handles ProgressBar2.RunTask

        Dim i As Integer
        For i = 0 To 100
            'Stop the task as soon as we can if the user has
            'stopped it from the client side
            If e.IsStopped Then
                Exit For
            End If

            'Here we call Thread.Sleep just for demonstration
            'purpose. You should replace this with code that
            'performs your long running task.
            System.Threading.Thread.Sleep(100)

            'You should frequently call UpdateProgress in order
            'to notify the client about the current progress
            e.UpdateProgress(i)
        Next i

    End Sub
End Class

eo_support
Posted: Sunday, September 23, 2007 2:00:55 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

That appears to be an issue and there doesn't seem to be a reliable workaround. We will get it fixed and posted an update for you as soon as possible.

Thanks
eo_support
Posted: Thursday, September 27, 2007 2:27:32 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

We have posted an update that addressed this issue. Please see your private message for download location.

Thanks
Repa
Posted: Wednesday, March 18, 2009 1:04:33 PM
Rank: Newbie
Groups: Member

Joined: 3/18/2009
Posts: 1
I have the same problem and in my case is rarely a case where i need to change the maximum value, what can i do ?

Give me an example, thanks !

Philipp Jenni wrote:
How i can change the maximum property when i use the server side progressbar
example? I create a recordset in the runtask method, and makes a for each loop. I know the
number of record only in this method, so want set a correct maximum value. But the control doesn't refresh the value.

Can you add a new function setMaxium to the Client API for the ProgressBar Object.
So i can add a Client Script to my page where correct the value.

Or have you another solution?

Here my example page:

ASPX:

Code: HTML/ASPX
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Test.aspx.vb" Inherits="Test" Debug="true" %>
<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>

<!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 runat="server">
    <title>My TestPage</title>
    
   
</head>
<body>
    <form id="form1" runat="server">
    <div>
         <eo:ProgressBar ID="ProgressBar1" runat="server" BackgroundImage="00060101"
            BackgroundImageLeft="00060102" BackgroundImageRight="00060103" ControlSkinID="None"
            IndicatorImage="00060104" IndicatorIncrement="7" ShowPercentage="True" StartTaskButton="Button1"
            Value="30" Width="250px">
        </eo:ProgressBar>
    </div>
        <asp:Button ID="Button1" runat="server" Text="Button" />
    </form>
</body>
</html>


VBS Code

Code: Visual Basic.NET
Partial Class Test
    Inherits System.Web.UI.Page



    Protected Sub ProgressBar1_RunTask(ByVal sender As Object, ByVal e As EO.Web.ProgressTaskEventArgs) Handles ProgressBar1.RunTask
        ProgressBar1.Maximum = 150

        Dim i As Integer
        For i = 0 To 150
            'Stop the task as soon as we can if the user has
            'stopped it from the client side
            If e.IsStopped Then
                Exit For
            End If

            'Here we call Thread.Sleep just for demonstration
            'purpose. You should replace this with code that
            'performs your long running task.
            System.Threading.Thread.Sleep(100)

            'You should frequently call UpdateProgress in order
            'to notify the client about the current progress
            e.UpdateProgress(i)
        Next i

    End Sub


End Class



thanks philipp
eo_support
Posted: Wednesday, March 18, 2009 1:18:18 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi Repa,

I believe our original reply has already answered your question.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.