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 !!
Never mind.
I just added
(ResponceObj.ResponseStatus == 1)
to the mix in the client side and it works beautifuly