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
275
About XmlHTTPResponseHandler (client side)
posted

 

 

 

 

 

 

 

 

I have a WebGrid bound to a SQLDataSource.

When a user wants to Delete a row and there is an Exception, I catch it and show a message in the sqldatasource_Deleted Event (VB code behind).

But then I need to tell the client side NOT to delete that row, because of the exception.

So far I have this, but it always cancels the row deletion. I mean it does not distinguish when there was an exception :

<head id="Head1" runat ="server">
<
script type ="text/javascript">

 

function gridClaim_XmlHTTPResponseHandler(gridName, rowId, gridResponse) {

var ResponceObj = gridResponse;

 

if

(ResponceObj.ReqType == igtbl_reqType.UpdateRow ||

ResponceObj.ReqType == igtbl_reqType.AddNewRow ||

ResponceObj.ReqType == igtbl_reqType.DeleteRow

) {

ResponceObj.Cancel = true;

alert(ResponceObj.StatusMessage);

}

}

</script >
</
head >

 

 

Can you help us please ??

THX !!

  • 275
    Verified Answer
    posted

    Never mind.

    I just added

    if

     

    (ResponceObj.ResponseStatus == 1)

    to the mix in the client side and it works beautifuly