Welcome Guest Search | Active Topics | Sign In | Register

RunTask not reading Treeview GetCheckedNodes() upon first execution Options
Darrell Reinke
Posted: Wednesday, December 10, 2008 12:28:29 PM
Rank: Advanced Member
Groups: Member

Joined: 7/18/2008
Posts: 76
Good Afternoon,

I was wondering if you could point me in the right direction. I have a web page that has a eo.treeview with check boxes at level two and level three and a eo.progressbar with a startbutton defined.

The first time I click on the start button the "tvProcessing.GetCheckedNodes()" (using the debugger) will not return any checked nodes even though I have checked some. However, if you click on the startbutton again, it works correctly. Is there a postback that is happening between the first and second execution of the startbutton that allows you to retrieve the checked nodes in the treeview?

snippet of RunTask code:
Code: Visual Basic.NET
Private Sub pbarQIRProcess_RunTask(ByVal sender As Object, ByVal e As EO.Web.ProgressTaskEventArgs) Handles pbarQIRProcess.RunTask
      e.UpdateProgress(0, "Running...")

      Dim i As Integer = 0
      Dim sError As String = ""
      Dim iChecked As Integer = 0
      Dim iTotalProcessingCnt As Integer = 0

      Dim tvNodes As EO.Web.TreeNode() = tvProcessing.GetCheckedNodes()
      Dim tvNode As EO.Web.TreeNode
      For Each tvNode In tvNodes
         'Checkbox has been checked to perform processing, etc.
         i = i + iProgressCnt
         e.UpdateProgress(i, "info")
      Next

End Sub


Thank you,

Darrell Reinke
Darrell Reinke
Posted: Wednesday, December 10, 2008 2:23:24 PM
Rank: Advanced Member
Groups: Member

Joined: 7/18/2008
Posts: 76
Update. I think I figured out that a postback does not occur with the when the RunTask is triggered, thus the first time through, the treeview object appears empty. Am I going to have to "hi jack" the _DoPostBack() function before calling the eo_GetObject("progressBar").startTask() so I can read what check boxes have been selected in the treeview? If so, how do you go about doing that?

Thank you for your help.
eo_support
Posted: Wednesday, December 10, 2008 3:28:51 PM
Rank: Administration
Groups: Administration

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

RunTask is a very special event because it needs to communicate with the client side (in order to move the progress bar) before the event handler returns. Because of this special characteristic, it works slightly different than regular post back.

If you wish to have all the benefits of a post back, the easiest way is to have a true post back first. Thus starting the progress bar would be a two step process:

1. The client side causes a post back. This can be achieved by a regular button or calling __doPostBack directly. You can also use ASP.NET AJAX or our CallbackPanel to avoid full page reload on this step;
2. The server side code renders the following JavaScript code to the client side:

eo_GetObject("progressBar").startTask();

This can be rendered by setting a Label's Text to "<script type='text/javascript'>eo_GetObject('progressBar').startTask();</script>".

Now when RunTask is triggered, everything should have already been updated.

Hope this helps.

Thanks!
Darrell Reinke
Posted: Thursday, December 11, 2008 6:02:11 AM
Rank: Advanced Member
Groups: Member

Joined: 7/18/2008
Posts: 76
Once again, impeccable customer service. It works great!!! Thank you helping me understand this process.


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.