Welcome Guest Search | Active Topics | Sign In | Register

Help with Progress Bar Options
Brian Ford
Posted: Wednesday, August 17, 2011 7:03:49 PM
Rank: Member
Groups: Member

Joined: 8/5/2010
Posts: 16
I am trying to use the ProgressBar to show progress of an operation:

I have a button on my form (cmdGo) which is set as the StartTaskButton
I have placed my code inside the _RunTask sub routine, the code is retrieving 500 records from a database, and loops through each record performing an action.

Everything works and the progressBasr is showing correctly, however....I cannot seem to continue any page processing once the loop has finished...

here's an edited version of my routine...

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

' retieve database records here

Progress.Value = 0
Progress.Maximum = getNumRecords()

Try
mySqlConnection.Open()
myDataReader = mySqlCommand.ExecuteReader(CommandBehavior.CloseConnection)

Do While (myDataReader.Read())

' do some work on each record

e.UpdateProgress(rowCounter) <== update the progress bar
Loop

Catch ex As Exception
lblError.Text = ex.Message
lblError.Visible = True

Finally
myDataReader.Close()
mySqlConnection.Close()

End Try

' When finished, show a dialog box
dlgFinished.Show()

End Sub

the problem I have is the dialog box never shows...
what am I missing :)

Thanks
eo_support
Posted: Wednesday, August 17, 2011 7:49:35 PM
Rank: Administration
Groups: Administration

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

That's very normal. That's how the progress bar works. RunTask runs inside a separate "channel" so that it is possible for you to send progress information to the client continuously. That channel ONLY updates the progress bar. It does not update anything else.

In order to show UI after the progress bar is done, you will need to allow the separate channel to finish first, then start a different request (this request will be normal) to perform whatever additional updates you would like to update. In this additional request you can do anything you'd like to do normally.

You can find a working sample that demonstrates this idea here:

http://demo.essentialobjects.com/Demos/Progress%20Bar/Server%20Side%20Task%20-%20Advanced%202/Demo.aspx

This sample uses a CallbackPanel to start the second request, in practice you can use anything that works for you since what you do after the task is done no longer has anything to do with the progress bar. For example, you can even display the dialog with our client side JavaScript interface without having to go back to the server again at all.

Hope this helps.

Thanks
Brian Ford
Posted: Wednesday, August 17, 2011 9:31:36 PM
Rank: Member
Groups: Member

Joined: 8/5/2010
Posts: 16
Thanks

I tried using the code in your sample link, when I click start, the progress runTask runs fine and the progress bar updates, but...the labels do not get changed.

I'm not familiar with the Callback so what else could I be missing, do I need to set any triggers on the callback, if so, what would they be??

The runTask event fires and the e.UpdateProgress(i, "Half done...") does execute

The following event also fires:

Protected Sub CallbackPanel1_Execute(ByVal sender As Object, ByVal e As EO.Web.CallbackEventArgs) Handles CallbackPanel1.Execute

If e.Parameter = "start" Then
e.Data = "start"

' Perform action before running progBar
lblFinished.Text = "running..." <= this line does get hit but the label doesn't update

ElseIf e.Parameter = "done" Then
e.Data = "done"

' Perform action after finished
lblFinished.Text = "Finished..." <= this line does NOT get hit

End If

End Sub

Do I need to set the CientSideOnTaskDone & ClientSideOnValueChanged properties of the ProgressBar? if so, what to?

Sorry for my lack of understanding here Brick wall
eo_support
Posted: Wednesday, August 17, 2011 9:51:40 PM
Rank: Administration
Groups: Administration

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

You definitely want to understand how it works instead of just copying the sample code. We will point you to where to look and help you understand how the product works. But we won't write, review or debug your code, or to devise/recommend a solution for specific customer scenarios for that matter. In simple terms, we do not work on your project. So if you do not know what the CallbackPanel is for or how to use it, then either do not use it, or take a look of the CallbackPanel control's documentation and samples to find out how to use it. Don't put it in just because of the sample has it.

The point of the sample is to show you how to do "something" after the progress bar is done. Obviously that “something” is beyond the control itself and totally up to you. You don't do that something exactly the same way as the sample does. Just use whatever available to you to implement what you wanted to implement. If you believe you have to use the CallbackPanel, or using the CallbackPanel (or any of our other controls) is the best solution, you can post a separate question about that control with the new question. Obviously in that case you will want to understand what that control is and why you want to use it first.

Similarly, you will have to ask yourself whether you need to set CientSideOnTaskDone or ClientSideOnValueChanged. We can explain what those properties are for to you, but we won't help you decide whether to use them or not. Those are your decisions after you understood what they are.

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.