I'm looking to handle multiple updatePanel asynchronous updates at a time. The don't have to update all the panels at the same time, I think that is impossible anyways, but I should handle each at a time and make a queue of unhandled updates. I have 3 update
panels, each with a button. The button click updates it's specific panel. If I click on another update button before the the first update has ended, I don't get the result from the first update. The default is to abort the previous asynchronous call, how
can I make it handle my requirment?
Your example works great, I could almost just copy and past the javascript code into my project!! I had a little trouble because my buttons had an animation extender onClick, and that somehow stopped the javascript from working. The animation used to disable
the button after one click. Can you help me with adding that functionality? I've tried to add to Page_load
I have also found some strange behavior when I use this javascript in Firefox, firefox does a full postback for all the queued items and doesn't show the queued items PpdateProgress?? IE 6 handles them fine...
Don't forget to click "Mark as Answer" on the post that helped you.
This marks your thread as Resolved so we will all know you have been helped.
You may try to cache the request, not the control.
function InitializeRequest(sender, args)
{
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (prm.get_isInAsyncPostBack())
{
args.set_cancel(true);
Array.add(myQueue, args.get_request());
}
}
And create an Sys.Net.XMLHttpExecutor object to send it in CompleteRequest.
The demo I wrote is used to illustrate the idea, but may not work with all browsers. You need to extend it.
Can we load data for multiple UpdatePanel at same time. I mean, I have 4 UP on 1 page, and initially when my page gets loaded none of the UP will show any data. Then using Timer control I make a asyn post back and start
updating the UP. But this happens 1 by 1, i.e. it will first load UP1 then UP2 and so on..cant we load data for all UP in one go..or it its not possible [:^)]
Is there some way the requests can be made to operate at the same time? Currently they are being queued but lets say we need the action of 3 buttons to operate simultaneously.Is this possible?
This can be seen here at pageflakes.com. If you have 2 'flakes' each having refresh icon/button, clicking on them one after the another brings out the behavior that I asked in my query.
Is there some way the requests can be made to operate at the same time? Currently they are being queued but lets say we need the action of 3 buttons to operate simultaneously.Is this possible?
This can be seen here at pageflakes.com. If you have 2 'flakes' each having refresh icon/button, clicking on them one after the another brings out the behavior that I asked in my query.
Thanks for your replies
Sandy
Pageflakes uses GET requests to web services, not UpdatePanels. As far as I know, you can't execute multiple simultaneous partial postbacks in the current framework.
This is a great example! Is there a way while queueing the Async postbacks to fire up the UpdateProgress so that the user can see that those that are in the queue are not neglected and are waiting to process? Thanks!
I am also facing problems in the same context. I hope you will help me. Let me explain the problem.
I have same form as yours but instead of three buttons i have only one. everytime user clicks the button a call to database is made using a new Asynchronous call and the results are show in the grid on completion. For every database resule there is a new
row in the grid. The problem is, every asynchronous call executes after the previous one is completed showing a behaviour of queues. However i need pure asynchronous tasks that is the results of less time consuming should appear first even if it was started
at last. for more clarity here is code for both aspx and aspx.csIshfaq. before executing this code please make sure the connection string is ok for your machine. on execution click the button immidiately more than one times and see the start and end times.
Thanks in advance.
Regards,
Ishfaq Hussain
-----------------------------Sample.aspx
<%
@ Page
Language="C#"
AutoEventWireup="true"
CodeFile="Sample.aspx.cs"
Inherits="_sample" %>
<!DOCTYPE
html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml"
>
<
head id="Head1"
runat="server">
<title>Untitled Page</title>
Random rand =
new Random();
int n = rand.Next(10000, 11077);
//Guid taskId = Guid.NewGuid();
int taskId = ThreadCount;
string stime = System.DateTime.Now.TimeOfDay.ToString();
Tasks task = new
Tasks();
//task.guid = taskId;
I am facing the same problem as you. Did you get any solution for this?
I need this ugently. Please let me know.
Thanks and Regards,
Ishfaq Hussain
This was your question at the forum:
Hi Raymond
Is there some way the requests can be made to operate at the same time? Currently they are being queued but lets say we need the action of 3 buttons to operate simultaneously.Is this possible?
This can be seen here at pageflakes.com. If you have 2 'flakes' each having refresh icon/button, clicking on them one after the another brings out the behavior that I asked in my query.
I have experimented a lot with UpdatePanels but like earlier posts point out, multiple requests cannot be done at the same time.
The only way I was able to do it was by creating the XmlHttpRequest object directly and then using it to make the request. However a new object has to be made each time (like when a button is clicked). Then simultenous requests worked for me using both
GET and POST. The disadvantage is that you cannot retrieve or set the values of web controls at server side. This has to be done at client using JavaScript.
I think you would run into a problem even with XmlHttpRequest, because somewhere I read it can only do 2 at once in most browsers and after that it queues them with some internal mechanism.
Member
610 Points
337 Posts
handle multiple asynchronous calls
May 09, 2007 06:46 AM|benderm|LINK
I'm looking to handle multiple updatePanel asynchronous updates at a time. The don't have to update all the panels at the same time, I think that is impossible anyways, but I should handle each at a time and make a queue of unhandled updates. I have 3 update panels, each with a button. The button click updates it's specific panel. If I click on another update button before the the first update has ended, I don't get the result from the first update. The default is to abort the previous asynchronous call, how can I make it handle my requirment?
I have tried to make a variation of the following link but ran into problems with JScript: http://ajax.asp.net/docs/tutorials/ExclusiveAsyncPostback.aspx
Hopefully someone out there has run into this before, thanks for the help in advance.
Don't forget to click "Mark as Answer" on the post that helped you.
This marks your thread as Resolved so we will all know you have been helped.
All-Star
25004 Points
3737 Posts
Re: handle multiple asynchronous calls
May 11, 2007 02:47 AM|Raymond Wen - MSFT|LINK
Hi,
You can use a queue to cache all of the request, and submit them one by one.
Please try this:
Hope this helps.
All-Star
25004 Points
3737 Posts
Re: handle multiple asynchronous calls
May 11, 2007 02:52 AM|Raymond Wen - MSFT|LINK
Code behind:
Member
610 Points
337 Posts
Re: handle multiple asynchronous calls
May 11, 2007 04:25 AM|benderm|LINK
Your example works great, I could almost just copy and past the javascript code into my project!! I had a little trouble because my buttons had an animation extender onClick, and that somehow stopped the javascript from working. The animation used to disable the button after one click. Can you help me with adding that functionality? I've tried to add to Page_load
Button1.Attributes.Add("onclick", "this.disabled=true;");
Button2.Attributes.Add("onclick", "this.disabled=true;");
Button3.Attributes.Add("onclick", "this.disabled=true;");
to your example but then no update happens when the buttons are clicked.
Don't forget to click "Mark as Answer" on the post that helped you.
This marks your thread as Resolved so we will all know you have been helped.
Member
610 Points
337 Posts
Re: handle multiple asynchronous calls
May 11, 2007 06:03 AM|benderm|LINK
Don't forget to click "Mark as Answer" on the post that helped you.
This marks your thread as Resolved so we will all know you have been helped.
All-Star
25004 Points
3737 Posts
Re: handle multiple asynchronous calls
May 11, 2007 11:47 AM|Raymond Wen - MSFT|LINK
function InitializeRequest(sender, args)
{
var prm = Sys.WebForms.PageRequestManager.getInstance();
if (prm.get_isInAsyncPostBack())
{
args.set_cancel(true);
Array.add(myQueue, args.get_request());
}
}
And create an Sys.Net.XMLHttpExecutor object to send it in CompleteRequest.
The demo I wrote is used to illustrate the idea, but may not work with all browsers. You need to extend it.
None
0 Points
6 Posts
Re: handle multiple asynchronous calls
Jun 04, 2007 08:10 AM|aalok43|LINK
hey!
Can we load data for multiple UpdatePanel at same time. I mean, I have 4 UP on 1 page, and initially when my page gets loaded none of the UP will show any data. Then using Timer control I make a asyn post back and start updating the UP. But this happens 1 by 1, i.e. it will first load UP1 then UP2 and so on..cant we load data for all UP in one go..or it its not possible [:^)]
Thanks and regards,
AaLoK
All-Star
25004 Points
3737 Posts
Re: handle multiple asynchronous calls
Jun 04, 2007 08:59 PM|Raymond Wen - MSFT|LINK
Hi,
You can call the Update() method for all of them.
None
0 Points
3 Posts
Re: handle multiple asynchronous calls
Aug 02, 2007 11:47 AM|lostintime|LINK
Hi Raymond
Is there some way the requests can be made to operate at the same time? Currently they are being queued but lets say we need the action of 3 buttons to operate simultaneously.Is this possible?
This can be seen here at pageflakes.com. If you have 2 'flakes' each having refresh icon/button, clicking on them one after the another brings out the behavior that I asked in my query.
Thanks for your replies
Sandy
Member
9 Points
156 Posts
Re: handle multiple asynchronous calls
Aug 03, 2007 02:59 PM|donkaiser|LINK
Sorry for my ignorance with javascript.
how do you send Sys.Net.XMLHttpExecutor object to CompleteRequest?
Star
10226 Points
2494 Posts
ASPInsiders
MVP
Re: handle multiple asynchronous calls
Aug 03, 2007 06:26 PM|gt1329a|LINK
Pageflakes uses GET requests to web services, not UpdatePanels. As far as I know, you can't execute multiple simultaneous partial postbacks in the current framework.
A guide to combining jQuery and ASP.NET: jQuery for the ASP.NET developer
None
0 Points
2 Posts
Re: handle multiple asynchronous calls
Aug 08, 2007 07:47 PM|aminoplacid|LINK
This is a great example! Is there a way while queueing the Async postbacks to fire up the UpdateProgress so that the user can see that those that are in the queue are not neglected and are waiting to process? Thanks!
Member
20 Points
9 Posts
Re: handle multiple asynchronous calls
Sep 06, 2007 07:51 AM|ishfaque.hussain@gmail.com|LINK
Dear Raymond Wen,
Member
20 Points
9 Posts
Hoe to handle multiple asynchronous calls
Sep 06, 2007 08:14 AM|ishfaque.hussain@gmail.com|LINK
Hi Dear Sandy,
None
0 Points
3 Posts
Re: Hoe to handle multiple asynchronous calls
Sep 17, 2007 09:31 AM|lostintime|LINK
I have experimented a lot with UpdatePanels but like earlier posts point out, multiple requests cannot be done at the same time.
The only way I was able to do it was by creating the XmlHttpRequest object directly and then using it to make the request. However a new object has to be made each time (like when a button is clicked). Then simultenous requests worked for me using both GET and POST. The disadvantage is that you cannot retrieve or set the values of web controls at server side. This has to be done at client using JavaScript.
Sandy
Member
190 Points
90 Posts
Re: Hoe to handle multiple asynchronous calls
Sep 17, 2007 11:31 AM|wrayx1|LINK
I think you would run into a problem even with XmlHttpRequest, because somewhere I read it can only do 2 at once in most browsers and after that it queues them with some internal mechanism.
Member
20 Points
9 Posts
Re: Hoe to handle multiple asynchronous calls
Sep 18, 2007 11:46 PM|ishfaque.hussain@gmail.com|LINK
Thanks Sandy,
Regards
Ishfaq