You must Sign In to post a response.
  • Category: ASP.NET

    Please explain AsyncPostBackErrorMessage

    Hi!
    Please explain about AsyncPostBackErrorMessage
    I request you all to give examples and code if possible
    Thank you

    Regards
    Kamlesh
  • #648520
    AsyncPostBackErrorMessage , Normally we can sent error message to the client when an unhandled server error occurs during asynchronous postback the page.

    ScriptManager1.AsyncPostBackErrorMessage = e.Exception.Message;

    hope this help!

    thnx
    Muhil

  • #648584
    AsyncPostBackErrorMessage:
    Gets or sets the error message that is sent to the client when an unhandled server exception occurs during an asynchronous postback.

    please check below code:

    public string AsyncPostBackErrorMessage
    {
    get
    {
    if (this._asyncPostBackErrorMessage == null)
    {
    return string.Empty;
    }
    return this._asyncPostBackErrorMessage;
    }
    set
    {
    this._asyncPostBackErrorMessage = value;
    return;
    }
    }

    Regards
    Mr.Rajesh
    Software Engg.

  • #648590
    AsyncPostBackErrorMessage is to set or get error message which is to be sent to the client when an unhandled server exception occurs during an asynchronous postback.


    Using the AsyncPostBackErrorMessage property of the Script Manager class
    You can set the exception message that needs to be shown to the user to the AsyncPostBackErrorMessage property of the ScriptManager object. This can be achieved in the following way:



    scriptManager.AsyncPostBackErrorMessage = "Oops.. An error occurred while processing";



    you can also use event handler to handle error message:



    protected void OnAsyncPostBackErrorHandler(object sender, AsyncPostBackErrorEventArgs e)
    {
    scriptManager.AsyncPostBackErrorMessage = "Oops.. An error occurred while processing";

    }


    With Regards
    Kushal

  • #648625
    AsyncPostBackErrorMessage is a property which can set or get the error message occurred and inturn it would send the message to the client when an unhandled exception occurs during an aynchronous event


    protected void MyScriptmanager_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e)
    {
    MyScriptmanager.AsyncPostBackErrorMessage = e.Exception.Message;
    }


    This would hold the error message when an unhandled exception occurs on the asynchronous post back event

    Please mark this as Answer, if this helps

    Regards,
    Alwyn Duraisingh.M 
    << Database Administrator >>
    Jesus saves! The rest of us better make backups...


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.