Hi all;
The code below allows me to click on button1, go thru various commands and display progress to the updateprogress1 panel. It then continues to automatically "click" button2. The problem is trying to get updateprogress2 to display anything. The routine works and gives me the final results I expect but just does not display progress.
Does anybody know how I can get the updaterogress2 panel to display? This will eventually expand to 12 panels total.
Thanks!
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="TestCprog2.aspx.vb" Inherits="TestCprog2" %><%@ Import Namespace="System.Data"%><%@ Import Namespace="System.Data.SqlClient"%><%@ Import Namespace="System.Data.OleDb"%><%@ Import Namespace="System.Web.Configuration"%><%@ Import Namespace="System.Diagnostics"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server">
Protected Shared idList As New ArrayList()
Protected Shared Comp As String
Public NotInheritable Class Utils2
' sealed to ensure the utility class won't be inherited
Private Sub New()
End Sub
Public Shared Function GetConnString() As String
Return WebConfigurationManager.ConnectionStrings("CRAP_HOME_USE_ACCESS").ConnectionString
End Function
End Class
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
'Capacitors
Comp = "Capacitors"
Dim sqlConnection As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("conCString1").ConnectionString)
Dim ConnString As String = Utils2.GetConnString()
Dim querystring As String = String.Empty
querystring = "DELETE * FROM [Capacitors]"
Using conn As New OleDbConnection(ConnString)
Using cmd1 As New OleDbCommand(querystring, conn)
cmd1.CommandType = CommandType.Text
conn.Open()
cmd1.ExecuteNonQuery() 'delete capacitors
End Using
conn.Close()
End Using
Dim cmd As New SqlCommand
cmd.CommandType = CommandType.Text
cmd.Connection = sqlConnection
----CODE REMOVED FOR BREVITY----
Label1.Text = Cap & " Capacitors exported at " & DateTime.Now.ToString()
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
' Introducing delay for demonstration.
Comp = "Connectors"
UpdatePanel2.Update()
Dim sqlConnection As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("conCString1").ConnectionString)
Dim ConnString As String = Utils2.GetConnString()
Dim querystring As String = String.Empty
querystring = "DELETE * FROM [Connectors]"
Using conn As New OleDbConnection(ConnString)
Using cmd1 As New OleDbCommand(querystring, conn)
cmd1.CommandType = CommandType.Text
conn.Open()
cmd1.ExecuteNonQuery() 'delete connectors
End Using
conn.Close()
End Using
Dim cmd As New SqlCommand
cmd.CommandType = CommandType.Text
cmd.Connection = sqlConnection
----CODE REMOVED FOR BREVITY----
Label2.Text = Con & " Connectors exported at " & DateTime.Now.ToString() '237 at test
End Sub
Private Sub Button10_Click(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub
</script><html xmlns="http://www.w3.org/1999/xhtml" ><head id="Head1" runat="server"><title></title></head><body style="width: 1446px"><form id="form1" runat="server"><div><asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="0"></asp:ScriptManager><p style="font-family: 'Arial Black'; font-size: medium; font-weight: bold; font-style: normal"> Create Access copy for Home use</p><asp:Button ID="Button10" runat="server"
Text="Generate Home Use Database" /><asp:Button ID="Button11" runat="server"
Text="Return to Main" /> <asp:Label ID="Label12" runat="server" Text="Capacitors"></asp:Label> <asp:Label ID="Label13" runat="server" Text="Connectors"></asp:Label><asp:UpdatePanel ID="UpdatePanel1" runat="server" style="width:750px;" UpdateMode="Conditional"><ContentTemplate><fieldset style="width:750px;"><asp:Button ID="Button1" runat="server" Text="Export" OnClick="Button1_Click" Style="width: 56px" /> <asp:Label ID="Label1" runat="server" Text="Capacitors"></asp:Label> <div style="display: inline-block"><asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1"><ProgressTemplate><script type="text/javascript">
document.write("<div class='UpdateProgressBackground'></div>");</script><span class="UpdateProgressContent"
style="background-color: #FFFFFF; font-weight: bold; left: 572px; height: 29px;">Capacitor export in process...<asp:Image ID="CapWaitCap" runat="server" ImageUrl="~/Images/progress.gif" /></span></ProgressTemplate></asp:UpdateProgress></div></fieldset></ContentTemplate></asp:UpdatePanel><asp:UpdatePanel ID="UpdatePanel2" runat="server" style="width:750px;" UpdateMode="Conditional"><ContentTemplate><fieldset style="width:750px;"> <asp:Button ID="Button2" runat="server" Text="Export" OnClick="Button2_Click" Style="width: 56px" /> <asp:Label ID="Label2" runat="server" Text="Connectors"></asp:Label> <div style="display: inline-block"><asp:UpdateProgress ID="UpdateProgress2" runat="server" AssociatedUpdatePanelID="UpdatePanel2"><ProgressTemplate><script type="text/javascript">
document.write("<div class='UpdateProgressBackground'></div>");</script><span class="UpdateProgressContent"
style="background-color: #FFFFFF; font-weight: bold; left: 572px; height: 29px;">Connector export in process...<asp:Image id="CapWaitCon" runat="server" ImageUrl="~/Images/progress.gif"/></span></ProgressTemplate></asp:UpdateProgress></fieldset></ContentTemplate></asp:UpdatePanel><br /> </div></form><script type="text/javascript" language="javascript">
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler1);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler1);
var thebutton;
function BeginRequestHandler1(sender, args)
{
thebutton = args.get_postBackElement();
//alert(thebutton.id)
if (thebutton.id === "Button1") $get('UpdateProgress1').style.display = 'block';
if (thebutton.id === "Button2") $get('UpdateProgress2').style.display = 'block';
thebutton = args.get_postBackElement();
//alert("ID: " + thebutton.id);
thebutton.disabled = true;
}
function EndRequestHandler1(sender, args)
{
if (thebutton.id === "Button1") $get('UpdateProgress1').style.display = 'none';
if (thebutton.id === "Button2") $get('UpdateProgress2').style.display = 'none';
thebutton.disabled = false;
var str = thebutton.id;
//alert("Str: " + str);
if(document.getElementById("Button" + (parseInt(str.substring(6, str.length)) + 1)))
document.getElementById("Button" + (parseInt(str.substring(6, str.length)) + 1)).click();
//alert("Mod: " + "Button" + (parseInt(str.substring(6, str.length)) + 1));
}</script></body></html>