Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 20th, 2007, 10:26 AM
Registered User
 
Join Date: Feb 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Exception handling in a custom control

Hello,

I am writing a ASP.Net custom control (vs2005). I am implementing the usual methods such as Render,
LoadPostData etc. and that goes fine.
However, I just cannot find how I should handle exceptions for a custom control in a good way.
I want to be able to catch / thow exceptions in my control, and then catch/show those in the
page my control is in, without getting a error-page.

For example, when I make an event for my control, and I implement
code for this event in the page my control is in. How can I do this in
such a way that I dont get to see the default error page of .NET (and also not a custom error page).
I simply want to catch the exception in my page and (for example) show it in a label or so.
So, something like this below:

public partial class MyPage : System.Web.UI.Page
{
  ..

   public void MyControl1_TestEvent (EventArgs e)
  {
      try
     {
        // ... do something

     }
     catch (Exception ee)
     {
       lblError.Text = ee.Message;
     }

  }
  ..
}

What is the usual way to implement this? How do professional component developers deal with this subject?




 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exception Handling NewTitle2007 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 6 August 8th, 2007 04:03 AM
exception handling jay schumacher VB.NET 2002/2003 Basics 1 April 14th, 2006 08:40 AM
Exception handling aldwinenriquez General .NET 0 August 17th, 2005 06:13 PM



All times are GMT -4. The time now is 01:43 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.