我正在使用内容页面母版页.因此请提供适当的解决方案. [英] i'm using content page & master page. Accordingly Plz Provide proper solution.

查看:84
本文介绍了我正在使用内容页面母版页.因此请提供适当的解决方案.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法从内容页面访问验证控件到母版页面,也无法从内容页面的方法到母版页面获取(或bbring)异常,尽管该方法的返回类型为bool或void
我的代码就像;

在内容页面中:

i cant access validation control from conent page to the master page as well as i cant get (or bbring) out exception from method of my content page to the master page though that method has return type as bool or void
My code is like ;

In content page:

void validationmethod()
{
try
{
   IF(!STATEMENT)
   throw neew exception()
}
catch(Exc e)
{
msgbox.show(e.msg)              //<------ FROM HERE I AM NOT GETTING EXCEPTION OUT OF THE 
                                //         METHOD VALIDATIONMETHOD() TO THE MASTER PAGE''S CATCH BLOCK 
                                //          THOUGH I''M USING THROW EXCEPTION.
}
}





告诉我有关C#的任何概念,通过它我可以从CATCH块退出而无需执行母版页上的下一个代码.





Oterwise tell me about any concept in C# by which I can exit from the CATCH block without executing the next code from the master page.

推荐答案

如果您需要处理如果异常在调用堆栈中更高,则必须重新引发该异常.

If you need to handle an exception higher in the call stack then you must re-throw the exception.

try
{
...some code
}
catch(Exception ex)
{
...do something
throw ex;
}



但是,似乎您误解了母版页的概念和用法.



However, it seems as though you are mis-interrupting the concept and usage of a master page.


这篇关于我正在使用内容页面母版页.因此请提供适当的解决方案.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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