Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Automatic Error Handling

, 17 Mar 2008 CPOL
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" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Exception Handler Test</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <div>
					&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>Item1</asp:ListItem>
						<asp:ListItem Selected="True">Item2</asp:ListItem>
						<asp:ListItem>Item3</asp:ListItem>
					</asp:DropDownList>&nbsp;
					<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" />
					</asp:Calendar>
					<br />
					<asp:ListBox ID="_listBox" runat="server" Rows="3" SelectionMode="Multiple">
						<asp:ListItem Selected="True">Item1</asp:ListItem>
						<asp:ListItem>Item2</asp:ListItem>
						<asp:ListItem Selected="True">Item3</asp:ListItem>
					</asp:ListBox>
        </div>
			<br />
			<br />
			<asp:Button ID="_button" runat="server" OnClick="_button_Click" Text="Throw Exception" />
    </form>
</body>
</html>

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.

License

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

Share

About the Author

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

| Advertise | Privacy | Mobile
Web04 | 2.8.141029.1 | Last Updated 17 Mar 2008
Article Copyright 2008 by Andy Searls
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid