This question is locked. New answers and comments are not allowed.
Hi,
I have a combobox inside a Telerik grid. I am binding the data to the combobox OnRowDataBound event of the grid.
I am able to get the data in the call back function and bind it to the combobox. But the data is not getting populated in the combobox and it looks like it is disabled.
Please let me know if I am missing anything here.
I have a combobox inside a Telerik grid. I am binding the data to the combobox OnRowDataBound event of the grid.
I am able to get the data in the call back function and bind it to the combobox. But the data is not getting populated in the combobox and it looks like it is disabled.
Please let me know if I am missing anything here.
@(Html.Telerik().Grid<DirectoryViewModel>() .Name("gridPartitions") .DataKeys(keys => { keys.Add(k => k.Directory_ID); }) .DataBinding(dataBinding => { dataBinding.Ajax() .Select("_Grid_SelectDirectories", "Request", new { Guid = @Model.Guid }) .Delete("_Grid_DeleteDirectories", "Request", new { Guid = @Model.Guid }); }) .Columns(columns => { columns.Bound(c => c.Directory_ID).Visible(false); columns.Bound(c => c.Path).Width(100); // columns.Bound(c => c.Access).Width(100); columns.Bound(c => c.Directory_ID) .Title("Permission Sets") .ClientTemplate( Html.Telerik().ComboBox() .Name("<#= Directory_ID#>" + "_Combobox") .Enable(false) .AutoFill(true) .ToHtmlString() ); columns.Command(cmd => { cmd.Delete().ButtonType(GridButtonType.BareImage); }); }) .ClientEvents(events => { events.OnRowDataBound("AddAccess"); }) .Pageable() .Sortable() .Filterable() )function AddAccess(e) { var accessId = "#" + e.dataItem.Directory_ID + "_Combobox"; url = '@Url.Action("GetAccess", "Request")'; $.post(url, { nodeId: e.dataItem.Directory_ID, Guid: $("#Guid").val() }, function (data) { var combobox2 = $(accessId).data('tComboBox'); alert(data.length); combobox2.close(); combobox2.dataBind(data); }); }[AcceptVerbs(HttpVerbs.Post)] public JsonResult GetAccess(int nodeId) { var access = _requestRepository.GetPermissionSetsAppliedAtNode(nodeId).ToList(); return new JsonResult { Data = new SelectList(access, "PermissionSet_ID", "Name") }; }