Saturday, March 24, 2012

Conditional updatepanel updates automatically

Hi,

I have a page with a lot of reviews. Each review has some comments and a textbox to enter a new comment for that review. When a new comment is posted, I update the list of comments for that review. A single review and it's correponding comments and commenttextbox are embedded in an updatepanel with conditional update. The problem is that when a comment is added, ALL the updatepanels for ALL the reviews on the page are updated and not only the updatepanel for the review, which was commented. This makes my page slow. I am using FireBug and in the console view I can see that the contents of all the updatepanels, are sent over the wire. How can I avoid this? I only want to update the comments for a single review.

Thanks

Thomas

What is good to do is place each "review + comments" in a single UpdatePanel with UpdateMode = "Conditional". By default, each UpdatePanel has by the UpdateMode = "Always".

Hope this helps,
Regards


Hi, as a matter of fact, I have already placed everything in updatepanels with updatemode=conditional.

thanks

Thomas


please send your code !


Hi,

Thank you for your post!

When we use updatepanel,all the content of the page is sent to the server!

UpdatePanel controls work by specifying regions of a page that can be updated without refreshing the whole page. This process is coordinated by theScriptManager server control and the clientPageRequestManager class. When partial-page updates are enabled, controls can asynchronously post to the server.An asynchronous postback behaves like a regular postback in that the resulting server page executes the complete page and control life cycle. However, with an asynchronous postback, page updates are limited to regions of the page that are enclosed inUpdatePanel controls and that are marked to be updated.The server sends HTML markup for only the affected elements to the browser. In the browser, the client PageRequestManager class performs Document Object Model (DOM) manipulation to replace existing HTML with updated markup. The following illustration shows a page that is loaded for the first time, and a subsequent asynchronous postback that refreshes the content of anUpdatePanel control.

But when the Ayncpostback is returned, it only refresh the updatepanel(s) you nend to refresh.

If you have further questions,let me know!

Best Regards,

No comments:

Post a Comment