Contact
Send mail to the author(s) Email Me

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Sign In
Navigation

Tag Cloud
.NET Framework (27) AJAX (8) ASP.NET (14) C# (27) Cloud (1) Database (6) Dev Tools (2) Enterprise Library (1) Futures (1) General (5) Javascript (6) LINQ (2) Mobile (1) MSDTC (3) Quotes (3) SQL (3) Transactions (2) Visual Studio (3) WAS (2) WCF (13)

Archive
<February 2007>
SunMonTueWedThuFriSat
28293031123
45678910
11121314151617
18192021222324
25262728123
45678910

Categories

Blogroll
Home Feed your aggregator (RSS 2.0)
# Saturday, February 10, 2007

I frequently place an UpdatePanel around a paged GridView with inline editing.   During OnRowUpdating, the object is saved.   If the save was not successful, I like to show an alert box with the error message.  

I recently migrated from the Atlas May CTP to ASP.NET 2.0 AJAX.   The following code worked with the May CTP, but, from my research, has not worked since July CTP:

Page.ClientScript.RegisterStartupScript(typeof(string), "alertScript", "alert('Error Message');", true);

However, our pals at Microsoft have given us something just as good.   I found it by mistake while trying to put in a hack involving checking the value of ScriptManager.GetCurrent(Page).IsInAsyncPostBack.  Here is the AJAX-friendly equivalent:

ScriptManager.RegisterStartupScript(this.updatePanel, typeof(string), "alertScript", "alert('Error Message');", true);

Hope this helps someone.  There are many blog posts, with many more comments, with people compaining about this.

Saturday, February 10, 2007 8:21:42 AM (Eastern Standard Time, UTC-05:00)  #    Comments [28]   AJAX | ASP.NET  | 
Copyright © 2009 Scott Klueppel. All rights reserved.