I am using Jquery Datatables plugin. I am showing list of employee details with an provision to edit using the above plugin. My questioon is
Is it possible to set href property of the edit link dynamically along with razor syntax of MVC ?
If not what is the alternate solution to navigate to edit page ?
HTML markup is
table = $("#dataTableMenuRole").dataTable({
"ajax": {
"url": "@Url.Action("LoadGridView", "MenuSettings")",
"method": "POST",
"dataType": "json",
"data": function (d) {
d.roleId = $("#ddlRoles").val()
}
},
columns: [
{ "data": "MenuName" },
{ "data": "CanAdd" },
{ "data": "CanEdit" },
{ "data": "CanDelete" },
{ "data": "CanView" },
{ "data": "MenuRoleId" }
],
"bProcessing": true,
"aoColumnDefs": [{
"targets": 5,
"bSortable": false,
"render": function (data, type, full, meta) {
return '<a class="btn btn-info"
href="@Url.Action("Edit", new {id= data })"' >'+
//Here data cannot be assigned as shown
'<i class="fa fa-edit"></i>'+
'</a>'
}
}]
});