http://cbt.architectingconnectedsystems.com/50064/50064%20_Module_13.htm
Hope it helps
Chris
"Pat" <Pa...@newsgroups.nospam> wrote in message
news:EDC8AC28-1AB6-49E5...@microsoft.com...
Thanks a lot for your suggestion. I will try to use your way to handle it
and see whether it succeeds or not. Before doing that, I will show you what I
did before. I used web service proxy instead of Page.RegisterAsyncTask, which
was used by you. Here is the details showing you what I did:
1. My user control (which is enclosed by Ajax's UpdatePanel) uses web
service proxy, which has a method called GetEmployeeIDAsync and an event
named GetEmployeeIDCompleted. In the user control project, I added a Web
Reference and called as PatWS. The code-behind for this user control has
these codes:
private PatWS.PatWebService WS = new PatWS.PatWebService();
override protected void OnInit(EventArgs e)
{
base.OnInit(e);
WS.GetEmployeeIDCompleted += new GetEmployeeIDCompletedEventHandler
(OnGetEmployeeIDCompletedCompleted);
}
protected void Page_Load(object sender, EventArgs e)
{
if (!this.Page.IsPostBack)
{
//call asynchronously now
WS.GetEmployeeIDAsync (...);
}
}
protected void Page_Unload(object sender, EventArgs e)
{
WS.GetEmployeeIDCompleted -= OnGetEmployeeIDCompletedCompleted;
}
void OnGetEmployeeIDCompletedCompleted (Object source,
GetEmployeeIDCompletedEventArgs e)
{
// Use web service return (that is e.Result) to do something
}
2. I used WSPBuilder to create a sharepoint web part. In addition, I insert
the Ajax's ScriptManager to this web part so that the user control from above
is equipped with Ajax feature.
3. Deploy the web part feature from #2. The deploy has no problem. However,
when adding this web part to a sharepoint page, it has error. The reason is
the asynchronous call "WS.GetEmployeeIDAsync()" inside the Page_Load method.
Sharepoint page directive cannot accept async attribute (i.e., you cannot
setup async="true"). Now, if I commented out the statement
"WS.GetEmployeeIDAsync()", the web part can be added to the sharepoint page
without error.
So, I used web service proxy to make asynchronous call with no success. But
you used another way, which was Page.RegisterAsyncTask with success. Why it
is so? The method I used and yours should achieve the same result of
registering asynchronous web service on the sharepoint page.
Any thought? Thanks.
Pat
Hope my way works for you though!
Chris
"Pat" <Pa...@newsgroups.nospam> wrote in message
news:188C5B23-79FF-4809...@microsoft.com...
I used your methods for my user control and then plug in the user control to
a sharepoint web part. It works. Thanks for your suggestion.
Pat
--
Pat