用户控件错误处理 [英] User controls Error Handling

查看:112
本文介绍了用户控件错误处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一种方法可以在用户控件上运行,如果可以抛出异常,则可以代替显示错误页面以便继续加载页面,但是在位置显示消息用户控件应该是

我正在尝试的操作比try catch稍微复杂一些,对于所有未处理的异常,它必须是通用的,因此,例如,如果数据源控件丢失了与数据库的连接.我也知道gobal.asax中的全局错误处理,但是我的目标是单独处理单个用户控件上的错误.

I would like to know if there is a way to on a user control , if an Exception is thrown if it is possible to instead of showing an error page for the page to continue loading but show a Message in the place of where the user control is supposed to be

What I am attempting is a little bit more complex than try catch, this has to be generic for all un-handled exceptions, so if for instance a data-source control lost connection to a database. I also know about global error handling in gobal.asax , but I am aiming to individually handle errors on individual user controls.

推荐答案

如果我正确理解了您的问题,那么您可以使用" Try-Catch "块来捕获您的异常,然后向最终用户显示适当的消息.

请查看下面的链接以获取更多信息.
http://msdn.microsoft.com/en-us/library/0yd65esw%28v = VS.100%29.aspx
If I understood your question correctly, you may use "Try-Catch" block to catch your Exception and then display appropriate message to End-User.

Have a look at below link for more information.
http://msdn.microsoft.com/en-us/library/0yd65esw%28v=VS.100%29.aspx


是的,有一种方法.这就是所谓的异常处理.您编写代码来处理可能引发的异常并显示一条消息.
Yes, there is a way. It''s called Exception Handling. You write code to handle the Exceptions that may be thrown and display a message.


这篇关于用户控件错误处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆