October 2010
Intermediate to advanced
1920 pages
73h 55m
English
UpdatePanels and JavaScriptYou must take special care when using JavaScript with UpdatePanel controls. If you use the standard methods of the ClientScriptManager class for working with JavaScript, they will fail when called during an asynchronous request.
For example, I often use the Page.ClientScript.RegisterStartupScript() method from my server-side code to inject a JavaScript script into a page dynamically. The page in Listing 38.8 contains a Delete All Files button. When you click the button, and the FileHelper.DeleteAll() method returns true, a JavaScript alert box displays the message All Files Deleted Successfully! (see Figure 38.7).
Figure 38.7. Displaying a JavaScript alert.
Listing 38.8. ShowAlert.aspx
Unfortunately, the page ...
Read now
Unlock full access