Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
888
Cancelling an ajax deleteRow from the Code behind
posted

I have an UltraWebGrid implemented with ajax updates and deletions working just fine.  The issue comes when the deletion/update occurs on the server, and due to constraints decides not to perform the deletion/update.  What I need to be able to do is cancel the client side deletion/update of the row and display a message to the user.  I am currently trying to hook into the XmlHTTPResponseHandler and AfterXmlHttpResponseProcessed events to try to cancel the deletion.

Is there a way to do this?  The gridResponse parameter on the XmlHTTPResponseHandler has a property Cancel - that is always False.  It I force this to True - the deletion does not happen - but I have no way to determine if the cancel needs to take place based on input from the server.  Any ideas?

Thanks

Chad

  • 5
    Offline posted

    Hi! 

    Did you find a solution to this problem?  I was wondering about the same thing and your post came up when I searched the web. 

    This is how I solved my problem. 

    In code behind:

    Try
      'Delete operation...
    Catch ex As Exception
      gridClaim.ClientResponse.Tag = XmlHTTPRequestType.DeleteRow
      gridClaim.ClientResponse.ResponseStatus = XmlHTTPResponseStatus.Fail
    End Try

    In aspx file:

    function gridClaim_XmlHTTPResponseHandler(gridName, rowId, xmlResponceObject)
    {
      if (xmlResponceObject.ReqType == igtbl_reqType.DeleteRow && xmlResponceObject.ResponseStatus != 0)
      {
        xmlResponceObject.Cancel = true;
      }
    }