Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh Page After After Delegates EndInvoke

Status
Not open for further replies.

cappmgr

Programmer
Jan 29, 2003
639
US
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.
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); 
}
uxLabel2.Text does get the return value from the LongProcess method but the page does not reflect it.
Thank you,
Marty
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top