【需求】
在使用UserControl时,有时我们要捕获其抛出的Exception Info,但使用UserControl的页面和UserControl是平级关系,所以页面不能直接捕获UserControl的异常.这时,就要为UserControl使用一个方法:OnError
【实现】
①UserControl的try……catch里,加入下面类似代码
②在页面使用该UserControl抛的Exception
前台:
:后台:
【需求】
在使用UserControl时,有时我们要捕获其抛出的Exception Info,但使用UserControl的页面和UserControl是平级关系,所以页面不能直接捕获UserControl的异常.这时,就要为UserControl使用一个方法:OnError
【实现】
①UserControl的try……catch里,加入下面类似代码
②在页面使用该UserControl抛的Exception
前台:
:后台:
相关文章: