Showing posts with label method. Show all posts
Showing posts with label method. Show all posts

Wednesday, March 28, 2012

Multiple UpdatePanel issue request at a same time

Hi all,

I have a page contains more than one UpdatePanel with different triggers and I followed the method here to handle multiple requests:

http://ajax.asp.net/docs/tutorials/ExclusiveAsyncPostback.aspx

When one of the UpdatePanels has been triggered and refreshing, all the requests from other UpdatePanels in the page will be cancelled since prm.get_isInAsyncPostBack() returns true until the first request has been processed.

Are there any method to invoke multiple requests at the same time? Or else the user has to wait until the first request to be done before he/she can issue new requests with the other panels. I can accept the requests to be queued up and pending to be patched, but the PageRequestManager seems simply drops the previous or new requests depends on the implementation in the block:

if (prm.get_isInAsyncPostBack()) {
// drop new request or abort previous request
}

FYI, I found simliar post here:http://forums.asp.net/thread/1413005.aspx

Thank you.

HI Kylo,

I wondered the same thing. From all my reading, you can only send out one request at a time using the update panel. The only true asynchronous way to use asp.net AJAX is through web services. By default, the update seems to execute the latest request that was given and drop the previous.


Thanks for the reply, bebandit. In my case, I was converting a .NET 1.1 project to 2.0 to gain the benefit of easily adding ajax capabilities to the web application. UpdatePanel handles all ajax call, DOM manipulation and the UI rendering for me. If I have to write the client side web services call and UI refreshing HTML myself (not to mention to change some of the server side logic to web method as well), it would take too much development time and not worth to do in my business logic. Seem that I have to wait to see if there will be a truely "Asynchronous UpdatePanel" in the later release or I will look for the other AJAX libraries.


Thanks for the reply, bebandit. In my case, I was converting a .NET 1.1 project to 2.0 to gain the benefit of easily adding ajax capabilities to the web application. UpdatePanel handles all ajax call, DOM manipulation and the UI rendering for me. If I have to write the client side web services call and UI refreshing HTML myself (not to mention to change some of the server side logic to web method as well), it would take too much development time and not worth to do in my business logic. Seem that I have to wait to see if there will be a truely "Asynchronous UpdatePanel" in the future release or I will look for the other AJAX libraries.

Saturday, March 24, 2012

my javascript method not working with update panel

Hi All,

The gridview (inside a user control) i am using in my screen (.aspx page) have a Checkbox column in the end. When i click the checkbox in the header all the checkboxes are selected. (A long javascript code has been written for that in the user control)

Now I have applied a scriptmanager and update Panel on this user control, and since then the javascript which selects all the checkboxes is not working properly.

I would like to know what i can do to resolve this javascript issue. And also would like to know why using the basic tools of ASP.NET AJAX control is stopping my own javascript from firing.

Please Note: On leaving a validation on page, the page postback and shows the validation. After this the javascript of Gridview works fine.

I have tried searching on google, but was not able to find any satisfactory explanation to my problem. It would be great if you people can help me.

Thanks,

Shikha

Please post your source code.


Hi,

Thank you for your post!

It is normal when you place inline javascript in an undatepanel/

For more information and solution, seeUpdatePanel and Rendered (Inline)Javascript

It seems that the UpdatePanel essentially replaces the InnerHTML of a DIV with the delta returned from the server. If you try this yourself you will notice that any javascript elements in the html are not fired.

All javascript registered on the server-side (if you are using .NET) with the ScriptManager is put into a separate section of the returned delta. The atlas runtime obviously then loads these scripts into the document manually.

What if the returned HTML has Javascript tags already rendered in it? Nothing.:(
Such was our predicament and we had no control over the HTML that would be returned to the UpdatePanel (ReportViewer Control). Could we manually load the javascript ourselves when the UpdatePanel returns the payload? As it turns, we could.

You can create script elements on the fly and they get evaluated as you do. Atlas has the ScriptLoader object that will do it for you if your JavaScript is an external reference. Tweaking this idea we got a solution that found all the new Script elements and added them to the document.

If you have further questions,let me know.

Best Regards,