سؤال

I have an ASCX file and I'm doing some validation to the data available.

What I would like to do is say "If the data is invalid, set this.visible to false, and stop processing the ASCX file. I can add a "return" statement to my ASCX in Page_Load which stops processing just fine but I'm running into issues where I'm in 3-4 methods deep, and simply calling "return" just returns from the current method. Unless I bubble it all the way to the top there's no way to use it properly.

Is there a way I can stop the processing of a ASCX file at any point, not just from a top level method (by top level I mean a Page_Load for example).

Thanks!

هل كانت مفيدة؟

المحلول

You could use CompleteRequest to do what you are talking about.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top