Welcome Guest Search | Active Topics | Sign In | Register

Access to Grid control from within the starttask of a progressbar Options
Hub
Posted: Monday, August 22, 2011 5:12:35 PM
Rank: Advanced Member
Groups: Member

Joined: 3/16/2010
Posts: 101
Hello,

I am trying to use a progressbar to show the progress while iterating through the items of a grid and cannot understand why the grid control is not accessible in its latest state from within the RunTask of the progressbar.

I have reproduced (code below) what I saw in the following example including only the grid, the progressbar and and a button to trigger the start of the runtask.

I initialize the grid with some simple data in the page load sub. When triggered, the runtask shows a grid item count of zero.

What am I missing?

Thanks for your help.



Code: Visual Basic.NET
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            For i = 0 To 4
                Dim gi As EO.Web.GridItem = Grid1.CreateItem()
                gi.Cells(1).Value = "Item " + (i + 1).ToString
                Grid1.Items.Add(gi)
            Next
        End If
    End Sub

    Protected Sub ProgressBar1_RunTask(ByVal sender As Object, ByVal e As EO.Web.ProgressTaskEventArgs)
        '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        MsgBox("Number of items:" + Grid1.Items.Count.ToString)
        '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
        e.UpdateProgress(0, "Start")
        System.Threading.Thread.Sleep(1000)
        Dim i As Integer = 0
        For Each item As EO.Web.GridItem In Grid1.Items
            System.Threading.Thread.Sleep(1000)
            e.UpdateProgress(i * 20, item.Cells(1).Value)
            i = i + 1
        Next
        System.Threading.Thread.Sleep(1000)
        e.UpdateProgress(100, "Finish")
    End Sub


I do not know why the javascript does not show properly. I copied it again in the body of the message below this window...

Code: JavaScript
<head runat="server"cmt:d50139f7-2797-4a05-bbfc-4e96f54692e1--<title></title></head>
<script type="text/javascript"cmt:77ab3ded-dc62-4e15-bca5-65cef002f591--
      function ShowExtraData() {
          var pb = eo_GetObject("ProgressBar1");
          var extraData = pb.getExtraData();
          if (extraData) {
              var div = document.getElementById("divStatus");
              div.innerHTML =  extraData ;
          }
      }
   </script>
<body>
<form id="form1" runat="server"cmt:aa7c59c6-aa27-47f1-9079-ce67cf4b763d-- 
<asp:Button ID="Button1" runat="server"  Text="Button" />
 <eo:Grid ID="Grid1" runat="server" BorderColor="#C7D1DF" BorderWidth="1px"  
   FixedColumnCount="1" Height="113px" ItemHeight="19" Width="129px"cmt:bec44245-caa9-4793-b3e5-6185c3ceea91--
     <Columns>
         <eo:RowNumberColumn DataType="Integer" Width="20"cmt:60d12b3d-cd5e-4852-b2eb-de24ab4f0874--
         </eo:RowNumberColumn>
         <eo:StaticColumn HeaderText="Header"cmt:d9b44c72-2d48-4e92-a04a-e7ef472f31cd--
         </eo:StaticColumn>
     </Columns>
 </eo:Grid>
<div id="divStatus" style="background-color: #E6FFFF; border: 1px solid #808080; text-align: center; width: 249px;"cmt:678af37b-724c-4c72-abae-5f0f7b9e14cf--</div>
<eo:ProgressBar ID="ProgressBar1" runat="server" BackgroundImage="00060301" 
    BackgroundImageLeft="00060302" BackgroundImageRight="00060303" 
    ClientSideOnValueChanged="ShowExtraData" ControlSkinID="None" 
    IndicatorImage="00060304" onruntask="ProgressBar1_RunTask" ShowPercentage="True" StartTaskButton="Button1" Width="250px"cmt:ac55bf25-93bb-4f2a-97b0-7ce77103c026--
</eo:ProgressBar>
</form>
</body>

<head runat="server"><title></title></head>
<script type="text/javascript">
function ShowExtraData() {
var pb = eo_GetObject("ProgressBar1");
var extraData = pb.getExtraData();
if (extraData) {
var div = document.getElementById("divStatus");
div.innerHTML = extraData ;
}
}
</script>
<body>
<form id="form1" runat="server">
<asp:Button ID="Button1" runat="server" Text="Button" />
<eo:Grid ID="Grid1" runat="server" BorderColor="#C7D1DF" BorderWidth="1px"
FixedColumnCount="1" Height="113px" ItemHeight="19" Width="129px">
<Columns>
<eo:RowNumberColumn DataType="Integer" Width="20">
</eo:RowNumberColumn>
<eo:StaticColumn HeaderText="Header">
</eo:StaticColumn>
</Columns>
</eo:Grid>
<div id="divStatus" style="background-color: #E6FFFF; border: 1px solid #808080; text-align: center; width: 249px;"></div>
<eo:ProgressBar ID="ProgressBar1" runat="server" BackgroundImage="00060301"
BackgroundImageLeft="00060302" BackgroundImageRight="00060303"
ClientSideOnValueChanged="ShowExtraData" ControlSkinID="None"
IndicatorImage="00060304" onruntask="ProgressBar1_RunTask" ShowPercentage="True" StartTaskButton="Button1" Width="250px">
</eo:ProgressBar>
</form>
</body>
eo_support
Posted: Monday, August 22, 2011 9:27:36 PM
Rank: Administration
Groups: Administration

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

Please download the latest version from our download page. I believe this was not supported in our earlier versions but was added very recently.

Thanks!
Hub
Posted: Tuesday, August 23, 2011 8:59:04 AM
Rank: Advanced Member
Groups: Member

Joined: 3/16/2010
Posts: 101
Will do.
Thanks for your always amazingly fast support.

H


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.