0
我在我的页面上有异步呼叫, 这大约需要1分钟。 我需要在呼叫完成后更改UI。 示例代码如下。如何在异步调用后更改我的页面的UI?
protected void Unnamed1_Click(object sender, EventArgs e)
{
apicasystemWPMCheckStatsService.CheckStatsServiceClient obj = new apicasystemWPMCheckStatsService.CheckStatsServiceClient();
string xmlOptionForGetCheckStats = "<options><mostrecent count='1'/><dataformat>xml</dataformat><timeformat>tz</timeformat></options>";
string checkId = "";
TextBox1.Text = TextBox1.Text + "test" + "\r\n";
obj.BeginGetCheckStats("[email protected]", "Cu4snfPSGr8=", "PD6B685A0-006A-4405-951E-B24BB51E7966",
checkId, xmlOptionForGetCheckStats, new AsyncCallback(ONEndGetCheckStats), null);
TextBox1.Text = TextBox1.Text + "testdone" + "\r\n";
}
public void ONEndGetCheckStats(IAsyncResult asyncResult)
{
System.Threading.Thread.Sleep(3000);
TextBox1.Text = TextBox1.Text + "testcomplete" + "\r\n";
}
问题是,我怎样才能在我的文本框中获得“testcomplete”。因为我的网页是没有得到登载异步调用后回....
我现在的O/P: 测试 testdone
预计: 测试 testdone testcomplet
嘿,Juhan,我知道这件事,顺便说一句,这只是示例代码,所以我的按钮名称是不正确的,在WebMethod我无法访问控件。和我的网页有3-4个用户控件和访问这些和代码也很复杂,所以我需要一些其他方式。 –
事情是,COntrol正在受到影响,就像我的文本框有Text属性来“测试testdone testcomplet”,但概率是由于页面没有刷新测试完成,从来没有进入文本框!!!!!你明白我的意思了吗? –