Recently, I had a user control I was developing throw an exception. I know what caused the exception, but this issue got me thinking. If I have a user control throw an exception for whatever reason and I wish to replace that usercontrol with something else (e.g. an error saying, "Sorry, this part of the page broke.") and perhaps log the error, what would be a good way to do it that could be done independently of what the user control is or does (i.e. I m not saying what the user control does/is, because I want an answer where that is irrelevant).
Code sample:
<asp:TableRow VerticalAlign="Top" HorizontalAlign="Left">
<asp:TableCell>
<UR:MyUserControl ID="MyUserControl3" runat="server" FormatString="<%$ AppSettings:RVUC %>"
ConnectionString="<%$ ConnectionStrings:WPDBC %>" Title="CO" />
</asp:TableCell>
<asp:TableCell>
<UR:MyUserControl ID="MyUserControl4" runat="server" FormatString="<%$ AppSettings:RVUA %>"
ConnectionString="<%$ ConnectionStrings:WPDBA %>" Title="IEAO" />
</asp:TableCell>
</asp:TableRow>