How to add Edit and Delete link/button to Jquery datatable for each row

To add edit/delete buttons, please follow the below code snippet:

 

columns: [
{ ‘data’: ‘LName’ },
{ ‘data’: ‘FMidName’ },
{ ‘data’: ‘DOB’ },
{// this is Actions Column
mRender: function (data, type, row) {
var linkEdit = ‘@Html.ActionLink(“Edit”, “Edit”, new {id= -1 })’;
linkEdit1 = linkEdit.replace(“-1”, row.ID);

var linkDetails = ‘@Html.ActionLink(“Details”, “Details”, new {id= -1 })’;
linkDetails = linkDetails.replace(“-1”, row.ID);

var linkDelete = ‘@Html.ActionLink(“Delete”, “Delete”, new {id= -1 })’;
linkDelete = linkDelete.replace(“-1″, row.ID);

return linkDetails + ” | ” + linkEdit + ” | ” + linkDelete;
}
}

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *