473,387 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Handling Exceptions in User Controls

Hi all. I'd like to replace user control( if it loads with exception
or fires exception during execution) with a friendly message. This
strategy is used in dotnetnuke but there they load controls in code but
i have to add them manually to aspx pages(historically). Can i somehow
handle it? For instance on render event?

Jul 25 '06 #1
2 1344
I think ur best bet will be to look into the Page_Error event of the user
control itself. It's like Page_Load, but fires when an exception occurs.
I'm not sure what you are able to do, but you might potentially be able to
do:

sub Page_Error(..)
Response.Write("Sorry, the module could not be loaded")
end sub

--
http://www.openmymind.net/
http://www.codebetter.com/
<ra****************@gmail.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
Hi all. I'd like to replace user control( if it loads with exception
or fires exception during execution) with a friendly message. This
strategy is used in dotnetnuke but there they load controls in code but
i have to add them manually to aspx pages(historically). Can i somehow
handle it? For instance on render event?

Jul 25 '06 #2
Thanks for reply. I'm already using Page_Error but it doesnt actually
handle the exception. After it is called the page life cycle breaks,
the page is not rendered and you see the error page. The problem is
within exceptions occured in oninit, page_load and so on events
happened in child controls because i cant wrape it with try catch. It's
possible to if the controls are loaded dynamically but if they are
placed on the page i dont know the solution.
Any ideas are welcome. :)

Karl Seguin [MVP] писал(а):
I think ur best bet will be to look into the Page_Error event of the user
control itself. It's like Page_Load, but fires when an exception occurs.
I'm not sure what you are able to do, but you might potentially be able to
do:

sub Page_Error(..)
Response.Write("Sorry, the module could not be loaded")
end sub

--
http://www.openmymind.net/
http://www.codebetter.com/
<ra****************@gmail.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
Hi all. I'd like to replace user control( if it loads with exception
or fires exception during execution) with a friendly message. This
strategy is used in dotnetnuke but there they load controls in code but
i have to add them manually to aspx pages(historically). Can i somehow
handle it? For instance on render event?
Jul 25 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Hans-Joachim Widmaier | last post by:
Hi all. Handling files is an extremely frequent task in programming, so most programming languages have an abstraction of the basic files offered by the underlying operating system. This is...
34
by: rawCoder | last post by:
I have read that Exception Handling is expensive performance wise ( other than Throw ) , but exactly how ? Please consider the following example ... ////////////////// Code Block 1...
2
by: Rajeev Soni | last post by:
Hi, Considering the scenario for handling exceptions in Web Application where we have Presentation layer, Business layer and Data Access layer; if there any exception is occurred in DAL, what is...
14
by: Mr Newbie | last post by:
I am often in the situation where I want to act on the result of a function, but a simple boolean is not enough. For example, I may have a function called isAuthorised ( User, Action ) as ?????...
16
by: Chuck Cobb | last post by:
I'm implementing a centralized exception handling routine using the Enterprise Library Exception Management Application Block. I trap all unhandled exceptions to one place using the following...
4
by: Rob | last post by:
Hey all, So.. a simple FormView/SqlDataSource to handle inserting records into a table. The table has a primary key that the user enters (eg DiscountCode). If the user enters a duplicate the...
35
by: jeffc226 | last post by:
I'm interested in an idiom for handling errors in functions without using traditional nested ifs, because I think that can be very awkward and difficult to maintain, when the number of error checks...
1
by: Efi Merdler | last post by:
Hi, I created a user control, but instead of handling exception in the user control level I prefer to handle them in the containing form. In the load event of the containing form I'm using:...
35
by: eliben | last post by:
Python provides a quite good and feature-complete exception handling mechanism for its programmers. This is good. But exceptions, like any complex construct, are difficult to use correctly,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.