This question is locked. New answers and comments are not allowed.
Hello,
I am attempting to pass through a value to my bind action using the following code.
Here is my dataBinding function.
And here is my controller.
However, when _Filter executes on the binding, the "filter" parameter is null. Any clues? I've tried just about everything I can think of.
Thanks!
Nathan
I am attempting to pass through a value to my bind action using the following code.
<%= Html.Telerik().Grid() .Name("Grid") .DataBinding(dataBinding => dataBinding.Ajax().Select("Select", "Grid")) .ClientEvents(clientEvents => clientEvents.OnDataBinding("dataBinding")) %>Here is my dataBinding function.
function dataBinding(args) { var filter = ""; var filterableColumns = $("[prism-name^=filter-column]"); for(var i = 0; i < filterableColumns.length; i++) { if(filterableColumns[i].value != "") { if(filter != "") { filter += "~"; } filter += filterableColumns[i].getAttribute('prism-name').replace("filter-column-", "") + "=" + filterableColumns[i].value; } } args.data = $.extend(args.data, { filter: filter } ); } And here is my controller.
[GridAction] public ActionResult _Filter(string filter) { if (filter == null) { filter = string.Empty; } var project = filter.DeserializeFilterString<Project>(); return View(new GridModel<Project>(db.Projects.Where(p => (string.IsNullOrEmpty(project.ProjectType) || p.ProjectType.StartsWith(project.ProjectType))).ToList())); }However, when _Filter executes on the binding, the "filter" parameter is null. Any clues? I've tried just about everything I can think of.
Thanks!
Nathan