This question is locked. New answers and comments are not allowed.
Hi,
I have a Chckbox grid in a PartielView. The PartialView is displayed in a TabStrip which is embedded in a Grid. Everything is in Ajax mode and displays just fine, but when I post the array of checked values to my controller, it comes up null. Can someone please give me some help.
The PartialView :
The controller:
Any help is greatly appreciated.
I have a Chckbox grid in a PartielView. The PartialView is displayed in a TabStrip which is embedded in a Grid. Everything is in Ajax mode and displays just fine, but when I post the array of checked values to my controller, it comes up null. Can someone please give me some help.
The PartialView :
<script type="text/javascript"> displayChecked = function (taskId) { var $checkedRecords = $(':checked'); if ($checkedRecords.length < 1) { alert('Check a few grid rows first.'); return false; } else { $.ajax({ type: "POST", url: '/Tasks/DisplayChecked/', contentType: 'application/json; charset=utf-8', data: JSON.stringify({ checkedRecords: $checkedRecords , Id: taskId }), dataType: 'json' }) .success(function (result) { alert('Success'); }) .error(function (result) { alert('Failed'); }); return false; } } </script> <div style="width:400px"> <% =Html.Telerik().Grid<TTManager.Models.Employee>() .Name("Employees_" + ViewData["TaskId"].ToString()) .Columns(columns => { columns.Bound(o => o.UserName) .ClientTemplate("<input type='checkbox' name='checkedRecords' value='<#= UserName #>' />") .Title("") .Width(36) .HtmlAttributes(new { style = "text-align:center" }); columns.Bound(o => o.Name); }) .DataBinding(dataBinding => { dataBinding.Ajax() .Select("_GetTaskEmployees", "Tasks"); }) .Scrollable() .Footer(false) .ToHtmlString() %> </div> The controller:
public JsonResult DisplayChecked( string[] checkedRecords, int Id) { // checkedRecords is null, taskId is good. return Json("TaskEmployees"); } Any help is greatly appreciated.