Hi,
I've implemented some WCF code that returns me the data from a WCF call, it works, but behaves syncronously.
IAsyncResult BeginGetAsyncData(object src, EventArgs args, AsyncCallback cb, object state)
{
_client = new ServiceReference1.Service1Client();
return _client.BeginGetPermissionsByStaffID("xxx", cb, state);
}
void EndGetAsyncData(IAsyncResult ar)
{
//ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
ServiceReference1.tblUser_Permission[] permissions = _client.EndGetPermissionsByStaffID(ar);
System.Threading.Thread.Sleep(2000);
dgResults.DataSource = permissions;
dgResults.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
PageAsyncTask task = new PageAsyncTask(BeginGetAsyncData, EndGetAsyncData, null, null);
Page.RegisterAsyncTask(task);
txtOut.Text = "Waiting...";
}
What I am seeing is a two second pause, and THEN the "waiting" message appears. I didn't explicitly spawn a new thread, but as I understand it, that's not necessary when I define the WCF service as asyncronous.
Any help would be appreciated!