ActionLink in column
ActionLink in column
Hello,
I've encountered a little problem with creating column with actionlink.
I've got server-side processing which works fine but when i click on "Cancel" link in column Action i get following error:
[quote]The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Labs/Booking/CancelAsync/2[/quote]
Here is mine js for dataTables:
[code]$('#tableBooked').dataTable({
"bJQueryUI": true,
"bServerSide": true,
"sAjaxSource": "AjaxHandler",
"bProcessing": true,
"aoColumns": [
{ "sName": "Resource Id" }, // 0
{"sName": "Resource name" },
{ "sName": "Created On" },
{ "sName": "From" },
{ "sName": "To" },
{ "sName": "TenatId", "bVisible": false },
{ "sName": "User" },
{ "sName": "Status" },
{ "sName": "Actions",
"fnRender": function (oObj) {
return "Cancel";
}
}
]
});[/code]
method which should be called on action link click:
[code][HttpPost]
public JsonResult CancelAsync(int id)
{
var userId = (int)Session["userId"];
var user = m_dbContext.Get(u => u.Id == userId);
bool result = m_bookingService.CancelBooking(id, user);
return Json(new { Result = result});
}[/code]
and server side logic was based on: http://www.codeproject.com/Articles/155422/jQuery-DataTables-and-ASP-NET-MVC-Integration-Part#BackgroundSSP
I would be very gratefull for help since i've tried some examples but none of them worked :(
I've encountered a little problem with creating column with actionlink.
I've got server-side processing which works fine but when i click on "Cancel" link in column Action i get following error:
[quote]The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /Labs/Booking/CancelAsync/2[/quote]
Here is mine js for dataTables:
[code]$('#tableBooked').dataTable({
"bJQueryUI": true,
"bServerSide": true,
"sAjaxSource": "AjaxHandler",
"bProcessing": true,
"aoColumns": [
{ "sName": "Resource Id" }, // 0
{"sName": "Resource name" },
{ "sName": "Created On" },
{ "sName": "From" },
{ "sName": "To" },
{ "sName": "TenatId", "bVisible": false },
{ "sName": "User" },
{ "sName": "Status" },
{ "sName": "Actions",
"fnRender": function (oObj) {
return "Cancel";
}
}
]
});[/code]
method which should be called on action link click:
[code][HttpPost]
public JsonResult CancelAsync(int id)
{
var userId = (int)Session["userId"];
var user = m_dbContext.Get(u => u.Id == userId);
bool result = m_bookingService.CancelBooking(id, user);
return Json(new { Result = result});
}[/code]
and server side logic was based on: http://www.codeproject.com/Articles/155422/jQuery-DataTables-and-ASP-NET-MVC-Integration-Part#BackgroundSSP
I would be very gratefull for help since i've tried some examples but none of them worked :(
This discussion has been closed.