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

I also met the same probelm,I can't open the page. Can you email to me:hexiaobing6@tom.com,Thanks in adcance.

Saturday, January 05, 2008 2:53 AM by xiaohe

# 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

# re: Refresh UpdatePanel via JavaScript

thank you , it helps me alot ,

Saturday, May 24, 2008 7:09 AM by mahdokht

# re: Refresh UpdatePanel via JavaScript

This is awesome!

Thursday, August 07, 2008 10:05 AM by Alok

# re: Refresh UpdatePanel via JavaScript

You have saved me a chunck of time. There are some massive holes in the framework which require alot of time to work around.

So thanks for saving my day.

Ross

www.teameffect.com

Tuesday, August 12, 2008 9:54 PM by Ross

# re: Refresh UpdatePanel via JavaScript

Dear Raj,

Thanks very much. I am working on a business intelligence solution, and i have been wondering about this problem for a very very long time.

You solved it for me, and if you ever come to Denmark, then let me know. Then I will buy you a beer.

Thanks very much.

Søren

Tuesday, September 30, 2008 12:12 AM by Søren Jensen

# re: Refresh UpdatePanel via JavaScript

God bless you! You helped me to solve a BIG headache :) Cheers!

Thursday, October 30, 2008 5:56 AM by raziel

# re: Refresh UpdatePanel via JavaScript

Why is it simple solutions like this are so elusive.  You think "it must be harder than this!"

Great job on figuring out an elegant solution to this problem!

Wednesday, November 05, 2008 3:39 PM by Jake

Leave a Comment

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