Automatic page refresh
-
I am developing a web application that controls services on a remote computer(s). I have most of the application done, but am a bit stuck on one section, which runs 'scripts'. Basically I have say 10 services in a datagrid, and they should all be controlled in a pre-determined order. I can make the script run, but would like to give some feedback to the end user after each service has processed it given command. Ie, start the first service, make an 'tick' image visible in the datagrid on the client PC, and then move onto the next service. Currently, it processes the entire script, and returns a page back to the user with all the ticks there. How could I do this? I have tried a server.execute and server.transfer back to the page using session variables, but they all give similar a result (ie, process the entire page and then push the result back to the user). An early development sample test I was using in the Page_Load is:
If Not Session("curstep") Is Nothing Then 'curstep is assigned a # when the 'execute' button is pushed lblMessages.Text = Session("script") & " running..." Dim intStep As Int16 = Session("curstep") dgSteps.SelectedIndex = intStep Dim i As DataGridItem = dgSteps.SelectedItem Dim img As System.Web.UI.WebControls.Image = i.FindControl("imgProcess") img.Visible = True intStep += 1 Session("curstep") = intStep System.Threading.Thread.Sleep(1000) If intStep >= ddlSelectScript.Items.Count Then Exit Sub Server.Execute("scripts.aspx") 'call myself back to process the next step. End If
I would like the client page to reload on the server.execute line, or refresh the data somehow. Is there some other way of possibly doing this?