Last post Feb 06, 2018 09:50 AM by Eric Du
Feb 05, 2018 03:22 PM|Bulldog248|LINK
I'm using Visual Studio 2015 with SQL Server 2014, VB.
I have a case where multiple SQL database tables are exported. I would like the update panel to give progress by means of a changing message. When the "Capacitors" table is exporting then the message would be "Capacitor export in progress...", When the
"Connectors" table is exporting the message would change to "Connector export in progress...". I have the following but it is not working as expected. Each button_click should be able to change "Comp" to the appropriate value but nothing happens. However,
if I change the top line to Protected Shared Comp as String = "Capacitors" then at least I get a text output but it cannot be changed. Does anybody have any suggestions how I can obtain the desired results?
Thanks in advance!
.aspx file below:
Protected Shared Comp As String
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Comp = "Capacitors"
... more operations ...
Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Comp = "Connectors"
... more operations ...
<asp:UpdatePanel ID="UpdatePanel1" runat="server" style="width:750px;" UpdateMode="Conditional">
<asp:Button ID="Button3" runat="server" Text="Export" OnClick="Button3_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">
--- The line below should be able to change <%= Comp %> to "Capacitors" or "Connectors" depedning on which table is exporting.
style="background-color: #FFFFFF; font-weight: bold; left: 572px; height: 29px;"><%= Comp %> export in process...
<asp:Image ID="CapWaitCap" runat="server" ImageUrl="~/Images/progress.gif" />
Feb 05, 2018 04:00 PM|mgebhard|LINK
AFAIK, the update progress control is more like a placeholder that is shown while waiting for a HTTP response.
The main problem you are solving is has to do with how websites and browsers work. One request gets one response. The browser blocks until it gets the response. You'll need to send one request to get process started and return results to the browser.
Then poll the process.
returns the current progress and updates the DOM (current page). Stop the timer when the last step is reached.
Does the export process currently report on its progress?
Another approach is called long polling. Start the process and return when the first progress milestone is hit. Still the process must run in its own task. Update the DOM with the progress and immediately do another AJAX request. Return when the process
changes state and update the DOM with the new progress. Stop making AJAX requests when the last step is reached.
Feb 05, 2018 06:20 PM|Bulldog248|LINK
Could you rephrase this for a novice programmer?
Feb 06, 2018 09:50 AM|Eric Du|LINK
According to your description, I think you need a real time progress of the code behind function, please check the following tutorials:
How To Check Long Server-Side Process Progress In Real Time:
3 Different Ways to Display Progress in an ASP.NET AJAX Application: