I am using VS2010 framework 4.0. The web app has a master page and a content page. The content page has an UpdatePanel control. When updating the UpdatePanel, how to display error message incurred?
simple answer is : you put a lable inside the update panel, and when you want to show some error message, you just set the text of the label, and don't forget clear its value during next postback. (in fact, the best choice is set a timeout at client side
, for example, the message will disappear automatically after 9 seconds)
complex answer is : write a javascript function that show a layer( I mean div), the message will be shown inside the layer, user can click an "OK" or "Close" to close the pop up layer, you can call this method from server side when you want to display an
error message.
Marked as answer by BU XI - MSFT on Feb 27, 2012 12:54 AM
xihu24
0 Points
3 Posts
Display error message for UpdatePanel in content page
Feb 20, 2012 07:44 PM|LINK
I am using VS2010 framework 4.0. The web app has a master page and a content page. The content page has an UpdatePanel control. When updating the UpdatePanel, how to display error message incurred?
Thanks!
sushanth009
Contributor
6243 Points
1168 Posts
Re: Display error message for UpdatePanel in content page
Feb 20, 2012 08:10 PM|LINK
You can use the End Request Handler to show the error message when the Update Fails..
MarvinYan
Member
56 Points
8 Posts
Re: Display error message for UpdatePanel in content page
Feb 21, 2012 12:22 AM|LINK
simple answer is : you put a lable inside the update panel, and when you want to show some error message, you just set the text of the label, and don't forget clear its value during next postback. (in fact, the best choice is set a timeout at client side , for example, the message will disappear automatically after 9 seconds)
complex answer is : write a javascript function that show a layer( I mean div), the message will be shown inside the layer, user can click an "OK" or "Close" to close the pop up layer, you can call this method from server side when you want to display an error message.
chetan.sarod...
All-Star
65839 Points
11163 Posts
Re: Display error message for UpdatePanel in content page
Feb 21, 2012 02:16 AM|LINK
Hi, Please refer this
http://msdn.microsoft.com/en-us/library/bb398934.aspx
http://aspdotnetcodebook.blogspot.in/2008/04/exception-handling-with-update-panel.html
http://geekswithblogs.net/mnf/archive/2008/02/09/how-touse-different-client-ajax-updatepanel-error-handling-for-different.aspx
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.