When defining filter in my views using the new helpers, the filter values come back null. Here is one example (I have few other very similar grids all producing the exact same result for me).
In this example, I am giving the filter a value coming from the ViewBag.StatusID, however hard-coding a specific value (1) produces the same null value.
View
Controller
Request
In this example, I am giving the filter a value coming from the ViewBag.StatusID, however hard-coding a specific value (1) produces the same null value.
View
@(Html.Kendo().Grid<Mobooka.Models.Campaign>() .Name("CampaignsGrid") .Columns(columns => { columns.Bound(o => o.CampaignID).Title("ID").Width(80); columns.Bound(o => o.Offer.OfferName).Title("Offer"); columns.Bound(o => o.Offer.Advertiser.Company.CompanyName).Title("Advertiser").Width(180); columns.Bound(o => o.Status.StatusName).Title("Status").Width(100); }) .DataSource(dataSource => dataSource .Ajax() .Read(read => read.Action("GetCampaigns", "Home")) .Filter(filter => filter.Add(f => f.StatusID).Equals(ViewBag.StatusID))
.PageSize(25) .ServerOperation(true) ) .Filterable(filtering => filtering .Enabled(true) ) .Pageable(paging => paging .Enabled(true) .Info(true) .PageSizes(false) .Refresh(true) ) .Scrollable(scrolling => scrolling .Enabled(true) .Height(560) .Virtual(true) ) .Sortable(sorting => sorting .Enabled(true) .AllowUnsort(true) .SortMode(GridSortMode.SingleColumn) ) )
Controller
public ActionResult Index() { ViewBag.StatusID = (int)Enumerations.Status.Pending; return View(); } ... public JsonResult GetCampaigns([DataSourceRequest] DataSourceRequest request) { IEnumerable<Campaign> campaigns = db.Campaigns....; return new JsonNetResult(campaigns.ToDataSourceResult(request)); }
Request
-
Request URL:http://dashboard.mobooka.local/Admin/Home/GetCampaigns
-
Request Method:POST
-
Status Code:500 Internal Server Error