Ajax ASP.Net Tutorial

<%@ 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
    
    .errorMessage
    {
        background-color: Yellow;
        color: Red;
    }
    


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

    
    
    
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    prm.add_endRequest( prm_endRequest );
    function prm_endRequest(sender, args)
    {
        var spanError = $get("spanError");
        if (args.get_error())
        {
            args.set_errorHandled(true);
            spanError.innerHTML = "Could not complete your request";
        }
        else
        {
            spanError.innerHTML = "";
        }
    }