Ajax ASP.Net

File: UpdatePanelErrorServer.aspx
<%@ Page Language="C#" %>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        throw new Exception("Server Error");
    }
    protected void sm1_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e)
    {
        sm1.AsyncPostBackErrorMessage = "A server error occurred";
    }



    UpdatePanel Error Server


    
            id="sm1"
        OnAsyncPostBackError="sm1_AsyncPostBackError"
        Runat="server" />
            id="up1"
        runat="server">
        
                    id="btnSubmit"
            Text="Submit"
            OnClick="btnSubmit_Click"
            Runat="server" />