How Do I: Use JavaScript to Refresh an ASP.NET AJAX UpdatePanel?

In this video we learn two different ways of using JavaScript logic to refresh the content of an ASP.NET AJAX UpdatePanel control. The first way is to add a Button-type server control to the UpdatePanel and use JavaScript to trigger an asynchronous postback and ‘pretend’ that the postback was caused by the server control inside the UpdatePanel. The second way does not require any Button-type server control to be added to the UpdatePanel, but still allows us to use JavaScript logic to refresh the content of the UpdatePanel.

(The second technique was suggested by Dave Ward and you can read more on his weblog entry, “ Easily refresh an UpdatePanel, using JavaScript ”.)

Presented by Joe Stagner

Duration: 10 minutes, 5 seconds

Date: 13 July 2007

Watch the video   |   Download the video   |   Get VB code  or  C# code

Video downloads: WMV | Zune | iPod | PSP | MPEG-4 | 3GP

Audio downloads: AAC | WMA | MPEG-4 | MPEG-3 | MPEG-2

Comments : 5

Leave a Comment

jntiwari9 : On April 02, 2008 12:28 AM said:

This is a good tutorials for the beginners. I am so gratefule to you.

J.N.Tiwari

JoeStagner : On April 03, 2008 6:21 PM said:

Thanks - Glad it helped !

jeppe_r : On May 07, 2008 5:15 PM said:

Hmm, does this work in a asp.net 3.5?

I have tried it, when I write it, it doesnt work, it do "standard" postback all the time..

Have tried yours code, but stil standard postback, with the javascript..

You dont have any good reason, that I cant make it?

- otherwise good movies :)

Best regards Jeppe

shocker-z : On May 14, 2008 11:28 AM said:

Thanks for the tutorial.

jeppe_r you sure your using a standard HTML button? and not an ASP button? as a standard HTML button cant cause a standard postback as far as i'm aware.

Regards

Liam

Wardgp : On June 11, 2008 6:21 PM said:

I built this one using VS2008 and I can get all the asp and HTML buttons to work correctly, but when I substitute UpdatePanel1 for Button1 in the javascript nothing happens.  Anybody get this to work using the asp.net 3.5?  Think jeppe_r might have something.

Leave a Comment

You must be logged in to leave a comment. Click here to log in.