Hello friends,
I was trying to delete record from grid using ajax with jquery. I was able to delete the record from database but at the same time I want to remove the row from grid.
How can I refer, which row has been deleted?
I tried following:
function funDelete(id,row) {
alert("Start");
if (confirm("Do you want to delete this record?")) {
alert("Step 1");
try {
alert("ID:" + id);
$.ajax({
type: "POST",
url: "QCNotice.aspx/deleteComment",
data: "{'args':'" + id + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function() {
alert("Record has been deleted..");
row.css("background-color", "Red");
row.fadeOut(500, function() {
row.remove();
});
});
},
error: function(event, request, settings) {
alert(request);
}
});
}
catch (e) {
alert("Error:" + e.message);
}
}
return false;
}
In the function, I'm passing the record ID
Dim lnkDelete As New LinkButton
lnkDelete = gvRow.FindControl("lnkDelete")
Dim intID As Integer = lnkDelete.CommandArgument
lnkDelete.Attributes.Add("onclick", "return funDelete(" & intID & "," & e.Row.RowIndex & ");")
Even trying, its not working
row.css("background-color", "Red");
row.fadeOut(500, function() {
row.remove();
});
How can I use rowindex to hide row?
Any idea?
Thanks in advance