Refresh UpdatePanel via JavaScript - Raj Kaimal

Refresh UpdatePanel via JavaScript

I have seen this asked a couple of times in the newsgroups hence this post. A simple way of refreshing an UpdatePanel using JavaScript is to add a HiddenField to the page, change its value using JS and then have the HiddenField raise a postback event.

The HiddenField causes the UpdatePanel to refresh because it has been declared as a trigger, is a child trigger or because the UpdatePanel.Update() method is called in the HiddenField ValueChanged event handler. The sample code (mirror) shows these three scenarios.

Note: The HiddenField will obviously need to be registered as an async postback control (RegisterAsyncPostBackControl) if it is outside the UpdatePanel.

Published Sunday, January 21, 2007 1:35 AM by rajbk
Filed under: ,

Comments

# re: Refresh UpdatePanel via JavaScript

Simply can not display the page. I'm from China, so may be that's my problem, because of taiwan earthquake. Thanks reply anyway, I think i need to wait.

Also I think your articls are wonderful, especially in asp.net ajax.

Tuesday, January 23, 2007 1:14 AM by Didasoft

# re: Refresh UpdatePanel via JavaScript

Thanks Raj - saved my "life" when I was trying to implement accessible Ajax calls, i.e regular hyperlinks triggering updatepanel updates (follow my link to read the full article)

Wednesday, January 31, 2007 6:08 AM by Stefan Holmberg

# re: Refresh UpdatePanel via JavaScript

What a life safer, and a really elegant, easy solution. Thanks very much!

Wednesday, February 28, 2007 8:38 PM by Michael Lane

# re: Refresh UpdatePanel via JavaScript

Ditto all the praise. Thanks a bunch.

Wednesday, March 14, 2007 5:10 PM by Dave

# re: Refresh UpdatePanel via JavaScript

That's wonderful. I thought that I'll kill myself. 10x

Monday, March 26, 2007 6:10 AM by S@T@N

# re: Refresh UpdatePanel via JavaScript

Thanks a ton. You are a life saver :)

Thursday, April 12, 2007 12:19 PM by Mohit

# re: Refresh UpdatePanel via JavaScript

Thank you man, this archive save my life and team job hahaha on next month my payment is for you kkkk

Thursday, August 23, 2007 9:33 AM by Fabiano

# re: Refresh UpdatePanel via JavaScript

You da best! so many thanks.

Thursday, September 27, 2007 8:14 PM by Martin

# re: Refresh UpdatePanel via JavaScript

u rock!! Helped a lot!

Thursday, January 31, 2008 1:19 PM by sar

# Pete’s Dev Blog » Async postbacks from client side javascript

Pingback from  Pete’s Dev Blog » Async postbacks from client side javascript

Leave a Comment

(required) 
(required) 
(optional)
(required)