I am doing a POC for an async process. I'd like the Parent Page to get refreshed with data from the method that is invoked by a delegate but I can't figure out how.
uxLabel2.Text does get the return value from the LongProcess method but the page does not reflect it.
Thank you,
Marty
Code:
private string LongProcess(Int32 SleepTime)
{
Thread.Sleep(SleepTime);
Global.ProcessingResults.Add(g.ToString());
return "Process is complete after " + SleepTime + " seconds.";
}
private void uxRunProcess_Click(object sender, System.EventArgs e)
{
uxLabel2.Text = "Process started please wait. Do not hit the browser back button!";
g = Guid.NewGuid();
DelagteLongProcess dlp = new DelagteLongProcess(LongProcess);
AsyncCallback acb = new AsyncCallback(DLPCallBack);
IAsyncResult ar = dlp.BeginInvoke(Convert.ToInt32(uxProcessTime.Text) * 1000, acb, dlp);
Response.Write("<script>window.open('StatusPage.aspx?id=" + g.ToString() + "')</script>");
}
private void DLPCallBack(IAsyncResult res)
{
DelagteLongProcess dlp;
dlp = ((DelagteLongProcess)(res.AsyncState));
uxLabel2.Text = dlp.EndInvoke(res);
}
Thank you,
Marty