Environment:
Telerik: 2011.3.315
MVC: 3
EF: 4.1
I have a Grid -> Tabstrip -> PartialView -> Grid set up with Ajax. The inner-most Grid has checkboxes, so I use this to post the selections:
PartialView:
<
button class="t-button" onclick="displayChecked(<% =ViewData["TaskId"] %>)">Assign Selected</button>
Page:
function displayChecked(taskId) {
var checkedRecords = $(':checked');
var taskId = taskId;
if (checkedRecords.length < 1) {
alert(
'Check a few grid rows first.');
return;
}
else {
alert(taskId);
$(
'#result').load('<%= Url.Action("DisplayChecked", "Tasks")%>', { checkedRecords: checkedRecords, taskId: taskId });
return;
}
}
Controller:
public ActionResult DisplayChecked(string[] checkedRecords, int taskId)
{
}
When I click the button, I get the alert message with the taskId as expected, followed by an "MS JScript runtime error: Object doesn't support this property or method" in asset.asdx at this line:
return
e.each(function(){var w=i(this);u=i.meta?i.extend({},u,w.data()):u;if(!w.data(v)){var x=t.init(this,u);w.data(v,x);n.trigger(this,"load");if(t.success){t.success(x)}}})
If I change my code as follows, I don't get the error but I can no longer pass the taskId parameter:
Page:
$('#result').load('<%= Url.Action("DisplayChecked", "Tasks")%>', checkedRecords );
Controller :
public ActionResult DisplayChecked(string[] checkedRecords)
{
}
How can I send the taskId parameter without getting the JScript error?
Many thanks,
Radu