Click here to Skip to main content
13,141,429 members (79,354 online)
Click here to Skip to main content


75 bookmarked
Posted 17 Mar 2008

Automatic Error Handling

, 17 Mar 2008
Handle web and WinForms exceptions automatically.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
<html xmlns="">
<head runat="server">
    <title>Exception Handler Test</title>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
					&nbsp;<asp:TextBox ID="_textBox" runat="server" Columns="55">The quick brown fox jumped over the high fence at the zoo.</asp:TextBox>
					<br />
					<br />
					<asp:DropDownList ID="_dropDownList" runat="server">
						<asp:ListItem Selected="True">Item2</asp:ListItem>
					<asp:CheckBox ID="_checkBox" runat="server" Text="Check Box" />
					<br />
					<br />
					<asp:Calendar ID="_calendar" runat="server" BackColor="White" BorderColor="#999999"
						CellPadding="4" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt" ForeColor="Black"
						Height="180px" Width="200px">
						<SelectedDayStyle BackColor="#666666" Font-Bold="True" ForeColor="White" />
						<TodayDayStyle BackColor="#CCCCCC" ForeColor="Black" />
						<SelectorStyle BackColor="#CCCCCC" />
						<WeekendDayStyle BackColor="#FFFFCC" />
						<OtherMonthDayStyle ForeColor="#808080" />
						<NextPrevStyle VerticalAlign="Bottom" />
						<DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" />
						<TitleStyle BackColor="#999999" BorderColor="Black" Font-Bold="True" />
					<br />
					<asp:ListBox ID="_listBox" runat="server" Rows="3" SelectionMode="Multiple">
						<asp:ListItem Selected="True">Item1</asp:ListItem>
						<asp:ListItem Selected="True">Item3</asp:ListItem>
			<br />
			<br />
			<asp:Button ID="_button" runat="server" OnClick="_button_Click" Text="Throw Exception" />

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Andy Searls
Software Developer (Senior) Belami
United States United States
No Biography provided

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170915.1 | Last Updated 17 Mar 2008
Article Copyright 2008 by Andy Searls
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid