Welcome Guest Search | Active Topics | Sign In | Register

Progressbar Not Firing Options
Max Lopez
Posted: Friday, May 13, 2011 11:09:48 AM
Rank: Newbie
Groups: Member

Joined: 5/13/2011
Posts: 1
Hello everyone, I am building an ASP.net page for my company and I am testing the EO toolkit as I am quite impressed with and and can definately use many of these tools in our design. We don't currently have a support license, but if we include the toolset we will indeed need one.

Currently I am attempting to incorporate the Progressbar into a routine when we update our SQL server and create a work schedule for our clients. I think I have the page setup properly, but when I press on the button command to initiate the progress bar's runt task command, the post back refreshes the page but nothing happens. I have my placed code markers on the .vb page to test the data flow of our program, but it appears the page does not fully postback when I press on the "Start Button".

Here is the code, if it helps.
Code: HTML/ASPX
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="managebills.aspx.vb" Inherits="Billing_managebills" %>
<%@ Register assembly="EO.Web" namespace="EO.Web" tagprefix="eo" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
            width: 814px;
        }
        .style9
        {
        }
        .style10
        {
            width: 203px;
            height: 26px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<script type="text/javascript">
    function OnProgress(progressBar) {
        var extraData = progressBar.getExtraData();
        if (extraData) {
            //The following code demonstrates how to update
            //client side DHTML element based on the value
            //RunTask passed to us with e.UpdateProgress
            var div = document.getElementById("divStatus");
            div.innerHTML = extraData;
        }
    }
</script>
    <table cellspacing="0" class="style1">
        <tr>
            <td width="15%" align="left" colspan="0" rowspan="0" valign="top">
                <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu1" 
                    EnableViewState="False" IncludeStyleBlock="False" Orientation="Vertical">
                    <Items>
                        <asp:MenuItem NavigateUrl="~/Default.aspx" Text="Home"/>
                    </Items>
                </asp:Menu>
            </td>
            <td width="85%">
                <h2>
                    Welcome
                    <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
 to TVNS PORTAL 2010 Billing module
                </h2>
                <div>
                    <asp:Panel ID="Panel1" runat="server" BackColor="#5D7B9D">
                        <table cellspacing="1" class="style2">
                            <tr>
                                <td>
                                    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                                        AutoGenerateSelectButton="True" CellPadding="4" ForeColor="#333333" 
                                        GridLines="None">
                                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                        <EditRowStyle BackColor="#999999" />
                                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                        <SortedAscendingCellStyle BackColor="#E9E7E2" />
                                        <SortedAscendingHeaderStyle BackColor="#506C8C" />
                                        <SortedDescendingCellStyle BackColor="#FFFDF8" />
                                        <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                                    </asp:GridView>
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                </div>
                <div>
                    <asp:Panel ID="Panel2" runat="server" BackColor="#DDE4EC">
                        <table class="style2">
                            <tr>
                                <td class="style9">
                                     </td>
                                <td class="style9">
                                     </td>
                                <td class="style9">
                                     </td>
                                <td class="style9">
                                     </td>
                            </tr>
                            <tr>
                                <td bgcolor="#5D7B9D" class="style9">
                                    <asp:Label ID="Label1" runat="server" ForeColor="White" Text="DEPARTMENT"></asp:Label>
                                </td>
                                <td bgcolor="#5D7B9D" class="style9">
                                    <asp:Label ID="Label3" runat="server" ForeColor="White" Text="PROGRAM:"></asp:Label>
                                </td>
                                <td bgcolor="#5D7B9D" class="style9">
                                    <asp:Label ID="Label4" runat="server" ForeColor="White" Text="DATE CODE"></asp:Label>
                                </td>
                                <td bgcolor="#5D7B9D" class="style9">
                                    <asp:Label ID="Label5" runat="server" ForeColor="White" Text="YEAR"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td class="style10">
                                    <asp:TextBox ID="TextBox1" runat="server" Width="90px"></asp:TextBox>
                                </td>
                                <td class="style10">
                                    <asp:TextBox ID="TextBox2" runat="server" Width="90px"></asp:TextBox>
                                </td>
                                <td class="style10">
                                    <asp:DropDownList ID="DropDownList1" runat="server">
                                    </asp:DropDownList>
                                </td>
                                <td class="style10">
                                    <asp:DropDownList ID="DropDownList2" runat="server" DataTextField="YEAR">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td bgcolor="#5D7B9D" class="style9" colspan="4">
                                    <asp:Label ID="Label6" runat="server" ForeColor="White" Text="STATUS:"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td class="style9" colspan="4">
                                    <eo:ProgressBar ID="ProgressBar1" runat="server" BackgroundImage="00060101" 
                                        BackgroundImageLeft="00060102" BackgroundImageRight="00060103" 
                                        ControlSkinID="None" IndicatorImage="00060104" IndicatorIncrement="7" 
                                        ShowPercentage="True" Width="500px" StartTaskButton="Button1" StopTaskButton="Button2"
                                        OnRunTask="ProgressBar1_RunTask" ClientSideOnValueChanged="OnProgress">
                                    </eo:ProgressBar>
                                </td>
                            </tr>
                            <tr>
                                <td class="style9">
                                    <asp:Button ID="Button1" runat="server" CssClass="button" Text="Start" 
                                        Width="80px" />
                                </td>
                                <td class="style9">
                                    <asp:Button ID="Button2" runat="server" CssClass="button" Text="Cancel" 
                                        Width="80px" />
                                </td>
                                <td class="style9">
                                     </td>
                                <td class="style9">
                                     </td>
                            </tr>
                            <tr>
                                <td class="style9" colspan="4"><div id="divStatus"></div>
                                     </td>
                            </tr>
                            <tr>
                                <td class="style9">
                                     </td>
                                <td class="style9">
                                     </td>
                                <td class="style9">
                                     </td>
                                <td class="style9">
                                     </td>
                            </tr>
                        </table>
                    </asp:Panel>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                 </td>
            <td>
                 </td>
        </tr>
    </table>
</asp:Content>


Here is the .vb code behind.

Code: Visual Basic.NET
Imports System.Data.SqlClient
Imports System.Data
Partial Class Billing_managebills
    Inherits System.Web.UI.Page

    Dim _ClientBill As New ClientBill
    Dim _ClientSched As New ClientSched
    Dim _ClientInfo As New ClientInfo

    Protected Sub Billing_managebills_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim _LeftMenu As New LeftMenu
        Dim _userRights As New cls_UserRights

        Call _userRights.GetUserRights(Session("UserName"))

        Call _LeftMenu.CreateMenu(NavigationMenu, "Billing", _userRights)
        Label2.Text = Session("UserName")

        GridView1.DataSource = _ClientBill.GetAllDepartments
        GridView1.DataBind()

        ProgressBar1.Visible = False

        Call LoadDateCodes()
        Call LoadYears()

    End Sub

    Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand
        Select Case e.CommandName
            Case Is = "Page"
                GridView1.DataSource = _ClientBill.GetAllDepartments
            Case Is = "Select"
                Dim index As Integer = Convert.ToInt32(e.CommandArgument)
                Dim gvRow As GridViewRow = GridView1.Rows(index)
                'Label24.Text = gvRow.Cells(1).Text
                TextBox1.Text = gvRow.Cells(1).Text
                TextBox2.Text = gvRow.Cells(3).Text
        End Select
    End Sub

    Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged

    End Sub

    Private Sub LoadDateCodes()
        DropDownList1.Items.Clear()
        DropDownList1.Items.Add("JAN1")
        DropDownList1.Items.Add("JAN2")
        DropDownList1.Items.Add("FEB1")
        DropDownList1.Items.Add("FEB2")
        DropDownList1.Items.Add("MAR1")
        DropDownList1.Items.Add("MAR2")
        DropDownList1.Items.Add("APR1")
        DropDownList1.Items.Add("APR2")
        DropDownList1.Items.Add("MAY1")
        DropDownList1.Items.Add("MAY2")
        DropDownList1.Items.Add("JUN1")
        DropDownList1.Items.Add("JUN2")
        DropDownList1.Items.Add("JUL1")
        DropDownList1.Items.Add("JUL2")
        DropDownList1.Items.Add("AUG1")
        DropDownList1.Items.Add("AUG2")
        DropDownList1.Items.Add("SEP1")
        DropDownList1.Items.Add("SEP2")
        DropDownList1.Items.Add("OCT1")
        DropDownList1.Items.Add("OCT2")
        DropDownList1.Items.Add("NOV1")
        DropDownList1.Items.Add("NOV2")
        DropDownList1.Items.Add("DEC1")
        DropDownList1.Items.Add("DEC2")
        DropDownList1.Text = Session("GLBLDATECODE")
    End Sub

    Private Sub LoadYears()
        DropDownList2.Items.Clear()
        Dim conn As New SqlConnection()
        Dim varSQL As String
        varSQL = ""

        conn.ConnectionString = "Data Source=;Initial Catalog=TVNSPAYROLL;Integrated Security=True"
        Dim cmd As New SqlCommand(varSQL, conn)
        conn.Open()
        Dim reader As SqlDataReader = cmd.ExecuteReader
        DropDownList2.DataSource = reader
        DropDownList2.DataBind()
        reader.Close()
        conn.Close()
    End Sub

    Protected Sub ProgressBar1_RunTask(ByVal sender As Object, ByVal e As EO.Web.ProgressTaskEventArgs)
        e.UpdateProgress(0, "Starting...")
        Dim i As Integer
        For i = 0 To 99
            If e.IsStopped Then
                Exit For
            End If

            System.Threading.Thread.Sleep(500)
            e.UpdateProgress(i, "Calculating...")

        Next
        e.UpdateProgress(100, "Finished...")
    End Sub

    Protected Sub ProgressBar1_RunTask02(ByVal sender As Object, ByVal e As EO.Web.ProgressTaskEventArgs)
        Dim conn As New SqlConnection()
        Dim varSQL As String
        varSQL = "SELECT * FROM [BILLCLIENTDEMO]"
        conn.ConnectionString = "Data Source=TVNS-SQL-01;Initial Catalog=TVNSPAYROLL;Integrated Security=SSPI;Trusted_Connection=True;"
        Dim cmd As New SqlCommand(varSQL, conn)
        Dim da As New SqlDataAdapter(varSQL, conn)
        Dim dt As New DataTable
        Dim _cnt, _cnts As Double

        Dim _HasSchedule As Boolean
        da.Fill(dt)

        Using conn
            conn.Open()
            Dim reader As SqlDataReader = cmd.ExecuteReader
            If reader.HasRows = True Then
                _cnt = 100 / dt.Rows.Count
                _cnts = 0
                While reader.Read
                    If e.IsStopped Then
                        Exit While
                    End If
                    e.UpdateProgress(_cnts, "Running...")
                    Dim ntb(28) As String
                    Dim _DayOfWeek As String
                    Dim _StartDate, _FWD, _LWD As Date
                    Dim _Days As Integer
                    Dim a, b, x, y, z As Integer
                    Dim _Hours(16), _DayHrs(7), _TotHours As Double
                    Dim _DayName As String

                    _ClientSched = New ClientSched
                    _ClientInfo = New ClientInfo

                    _StartDate = _ClientSched.GetStartDate(DropDownList1.Text, DropDownList2.Text)
                    _FWD = _ClientSched.GetStartDate(DropDownList1.Text, DropDownList2.Text)
                    _LWD = _ClientSched.GetLWD(DropDownList1.Text, DropDownList2.Text)
                    _DayOfWeek = Weekday(_StartDate)
                    _Days = _ClientSched.GetTotalDays(DropDownList1.Text, Year(_StartDate))
                    _DayName = ""
                    _HasSchedule = _ClientInfo.GetMasterInfo(reader(1).ToString, TextBox1.Text)
                    If _HasSchedule = True Then
                        _DayHrs(0) = _ClientInfo.SunHours
                        _DayHrs(1) = _ClientInfo.MonHours
                        _DayHrs(2) = _ClientInfo.TueHours
                        _DayHrs(3) = _ClientInfo.WedHours
                        _DayHrs(4) = _ClientInfo.ThuHours
                        _DayHrs(5) = _ClientInfo.FriHours
                        _DayHrs(6) = _ClientInfo.SatHours

                        _TotHours = 0
                        b = 0
                        x = 1
                        z = 4
                        z = (_Days + (_DayOfWeek - 1))
                        Select Case _DayOfWeek
                            Case 1
                                _DayName = "SUNDAY"
                                x = _DayOfWeek - 1
                                a = _DayOfWeek - 1
                                y = x - 1
                                Do While y >= 0
                                    ntb(y) = 0
                                    y = y - 1
                                Loop
                                Do While x < _Days
                                    ntb(x) = _DayHrs(a)
                                    _Hours(b) = ntb(x)
                                    b = b + 1
                                    x = x + 1
                                    a = a + 1
                                    If a = 7 Then
                                        a = 0
                                    End If
                                Loop
                                Do While z < 28 And z >= 16
                                    ntb(z) = 0
                                    z = z + 1
                                Loop
                            Case 2
                                _DayName = "MONDAY"
                                x = _DayOfWeek - 1
                                a = _DayOfWeek - 1
                                y = x - 1
                                Do While y >= 0
                                    ntb(y) = 0
                                    y = y - 1
                                Loop
                                Do While x < _Days + 1
                                    ntb(x) = _DayHrs(a)
                                    _Hours(b) = ntb(x)
                                    b = b + 1
                                    x = x + 1
                                    a = a + 1
                                    If a = 7 Then
                                        a = 0
                                    End If
                                Loop
                                Do While z < 28 And z >= 16
                                    ntb(z) = 0
                                    z = z + 1
                                Loop
                            Case 3
                                _DayName = "TUESDAY"
                                x = _DayOfWeek - 1
                                a = _DayOfWeek - 1
                                y = x - 1
                                Do While y >= 0
                                    ntb(y) = 0
                                    y = y - 1
                                Loop
                                Do While x < _Days + 2
                                    ntb(x) = _DayHrs(a)
                                    _Hours(b) = ntb(x)
                                    b = b + 1
                                    x = x + 1
                                    a = a + 1
                                    If a = 7 Then
                                        a = 0
                                    End If
                                Loop
                                Do While z < 28 And z >= 16
                                    ntb(z) = 0
                                    z = z + 1
                                Loop
                            Case 4
                                _DayName = "WEDNESDAY"
                                x = _DayOfWeek - 1
                                a = _DayOfWeek - 1
                                y = x - 1
                                Do While y >= 0
                                    ntb(y) = 0
                                    y = y - 1
                                Loop
                                Do While x < _Days + 3
                                    ntb(x) = _DayHrs(a)
                                    _Hours(b) = ntb(x)
                                    b = b + 1
                                    x = x + 1
                                    a = a + 1
                                    If a = 7 Then
                                        a = 0
                                    End If
                                Loop
                                Do While z < 28 And z >= 16
                                    ntb(z) = 0
                                    z = z + 1
                                Loop
                            Case 5
                                _DayName = "THURSDAY"
                                x = _DayOfWeek - 1
                                a = _DayOfWeek - 1
                                y = x - 1
                                Do While y >= 0
                                    ntb(y) = 0
                                    y = y - 1
                                Loop
                                Do While x < _Days + 4
                                    ntb(x) = _DayHrs(a)
                                    _Hours(b) = ntb(x)
                                    b = b + 1
                                    x = x + 1
                                    a = a + 1
                                    If a = 7 Then
                                        a = 0
                                    End If
                                Loop
                                Do While z < 28 And z >= 16
                                    ntb(z) = 0
                                    z = z + 1
                                Loop
                            Case 6
                                _DayName = "FRIDAY"
                                x = _DayOfWeek - 1
                                a = _DayOfWeek - 1
                                y = x - 1
                                Do While y >= 0
                                    ntb(y) = 0
                                    y = y - 1
                                Loop
                                Do While x < _Days + 5
                                    ntb(x) = _DayHrs(a)
                                    _Hours(b) = ntb(x)
                                    b = b + 1
                                    x = x + 1
                                    a = a + 1
                                    If a = 7 Then
                                        a = 0
                                    End If
                                Loop
                                Do While z < 28 And z >= 16
                                    ntb(z) = 0
                                    z = z + 1
                                Loop
                            Case 7
                                _DayName = "SATURDAY"
                                x = _DayOfWeek - 1
                                a = _DayOfWeek - 1
                                y = x - 1
                                Do While y >= 0
                                    ntb(y) = 0
                                    y = y - 1
                                Loop
                                Do While x < _Days + 6
                                    ntb(x) = _DayHrs(a)
                                    _Hours(b) = ntb(x)
                                    b = b + 1
                                    x = x + 1
                                    a = a + 1
                                    If a = 7 Then
                                        a = 0
                                    End If
                                Loop
                                Do While z < 28 And z >= 16
                                    ntb(z) = 0
                                    z = z + 1
                                Loop
                        End Select
                        x = 0
                        Do While x < 28
                            _TotHours = _TotHours + Val(ntb(x))
                            x = x + 1
                        Loop
                        'tb58.Text = _TotHours
                        'lbl58.Text = "NEW ID"
                        _ClientSched.DeptNumber = TextBox1.Text
                        _ClientSched.datecode = DropDownList1.Text
                        _ClientSched.start_date = _StartDate
                        _ClientSched.start_day = _DayName
                        _ClientSched.client_number = reader(1).ToString
                        _ClientSched.day_1 = _Hours(0)
                        _ClientSched.day_2 = _Hours(1)
                        _ClientSched.day_3 = _Hours(2)
                        _ClientSched.day_4 = _Hours(3)
                        _ClientSched.day_5 = _Hours(4)
                        _ClientSched.day_6 = _Hours(5)
                        _ClientSched.day_7 = _Hours(6)
                        _ClientSched.day_8 = _Hours(7)
                        _ClientSched.day_9 = _Hours(8)
                        _ClientSched.day_10 = _Hours(9)
                        _ClientSched.day_11 = _Hours(10)
                        _ClientSched.day_12 = _Hours(11)
                        _ClientSched.day_13 = _Hours(12)
                        _ClientSched.day_14 = _Hours(13)
                        If Len(_Hours(14)) <= 0 Then
                            _ClientSched.day_15 = 0.0
                        Else
                            _ClientSched.day_15 = _Hours(14)
                        End If
                        If Len(_Hours(15)) <= 0 Then
                            _ClientSched.day_16 = 0.0
                        Else
                            _ClientSched.day_16 = _Hours(15)
                        End If
                        _ClientSched.YEAR = Year(_StartDate)
                        _ClientSched.BILLNOTE = "READY"
                        _ClientSched.BILLTYPE = "FIRST"
                        _ClientSched.BILLDATE = ""
                        _ClientSched.BILLPERIOD = ""
                        _ClientSched.BILLNUMBER = ""
                        _ClientSched.BILLERROR = ""
                        _ClientSched.SCHED_TOTAL = _TotHours
                        _ClientSched.FWD = _FWD
                        _ClientSched.LWD = _LWD
                        _ClientSched.Insert()
                    End If
                    _cnts = _cnts + _cnt
                End While
                e.UpdateProgress(100, "Finished...")
                _ClientSched.UpdateSchedMaster(DropDownList1.Text, TextBox1.Text)
                reader.Close()
                conn.Close()
            End If
        End Using
    End Sub
End Class


I have attempted to remove all of the SQL codebehind thining perhaps the progress bar sub routine could not handle it, but even now with just a sleep thread the progress bar willl not fire. I am sure this is a simple problem that I have overlooked, since this has worked on so many other web pages it would help us to get to understand how to integrate these tool sets into our page design.

Thank you so much for any assistance.
Max Lopez
eo_support
Posted: Friday, May 13, 2011 11:23:11 AM
Rank: Administration
Groups: Administration

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

Thanks for posting in the forum. We are not able to offer any support on your specific case unless you already have a license (officially we do not offer free support on free controls). So we can only offer a few general guidelines:

1. Try to get it working without your real SQL task code first. That is not to say there is anything wrong with your SQL code. But when it comes to troubleshooting the less code the easier;

2. Test the code in a separate standard alone page without a master page. This is the same idea as step 1;

3. Compare your test page with our sample page. Eventually you should be able to make the test page similar to our sample page. If the sample works and yours doesn't, then it should not be very difficult to locate the difference and find out what triggered the problem;

4. Alternatively, you can look into our client side JavaScript interface to see if you can trigger the progress bar on the client side. That will avoid any potential server side event issues;

Hope this will help you to get started.

Thanks!
Sameer Shah
Posted: Friday, June 3, 2011 11:28:33 AM
Rank: Newbie
Groups: Member

Joined: 6/3/2011
Posts: 1
Hello,
Thank you for posting the thread. It was very useful as to how you implemented this and the problems you were having. As quoted by the support team, u should probably try splitting your one major SQL call into several functions and ask them to return a bool true/false on completion.

I followed what you did and it is working for me.
I do SQL server calls, and print graphics. It works fine.

I use VS 2008 and the deployment is on IIS 7.0.

Please update us and thank you once more.


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.