Click here to Skip to main content
15,616,585 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two functions like-------------

    public static string[] loadTaskDetails(string projectTaskidwithabbv)


    public static string loadWorkNote(string projecttaskidwithabbv)


in javascript I have two functions let a() and b(). a() is calling loadWorkNote() first and b() loadTaskDetails() second.

This methods are called by ajax,and they are async.

Now loadTaskDetails() is calling a webservice (asmx) method and loadWorkNote() is calling another.

Problem is I can't make the two functions parallel.

If I use [System.Web.Services.WebMethod(enablesession=false)] above the loadWorkNote() and use thread.sleep(8000),its still freezing the main dom. After its execution completed,loadTaskDetails() is started working.

But if I use enablesession=false in @page directive of this page,then its working parallely.

So my questions are...................

1)If I use session in this page,"enablesession=false" in @page will create problem or not?If yes,then how to implement this?

2)why "enablesession=false" didn't work for a particular webmethod?If it works then I don't have to create this in @page for whole page.

3) In some example I'm seeing they are creating async call of webservice method (kiteserv.loadWorkNoteByTaskidAsync()) and calling methodcompleted event (kiteserv.loadWorkNoteByTaskidCompleted += delegate(object sender, kitesRef.loadWorkNoteByTaskidCompletedEventArgs e))

I've tried this.

Problems are............................................

1)From the completed event I can't return string value but loadWorkNote() must return string.
2)If I use return out of the scope of completed event,my code first reaches to return statement and return blank value and then completed event fired which is returning nothing as usual.

So please help me what am I doing wrong and what's the correct process.Actually I've implemented web services before but want to use thread first.
Updated 28-Jun-15 19:15pm
Sreekanth Mothukuru 29-Jun-15 2:41am    
You haven't shared code on calling your webmethods from client side. Lets inspect client side code. I guess you are using jQuery Ajax async calls.
souvikcode 29-Jun-15 6:29am    
Yes.every one know jquery ajax calls to webmethod.Thats why I have not written all those.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900