This question is locked. New answers and comments are not allowed.
hi there
I have a grid with an option to search for a company. it is working great, but when I page the grid, it loses the criteria and resets to a full list again. Is there a way to keep the criteria of the user?
Controller
View
I have a grid with an option to search for a company. it is working great, but when I page the grid, it loses the criteria and resets to a full list again. Is there a way to keep the criteria of the user?
Controller
[HttpGet]public ActionResult CompanyList(){ var model = _saleService.GetCompanyList(); return View(model);}[HttpPost]public ActionResult CompanyList(FormCollection formCollection){ string companyName = formCollection["uxSearch"].ToString(); var model = _saleService.GetCompanyList(); if (String.IsNullOrEmpty(companyName)) { ModelState.AddModelError("", "Please enter a company name"); } else { model = _saleService.GetCompanyList(companyName); } return View(model);}View
@model IList<Company.ViewModels.CompanyList>@{ Layout = "~/Views/Shared/_SecureLayout.cshtml";}@using (Html.BeginForm()){ @Html.ValidationSummary(true, "Please enter a name before searching."); <input type="text" name="uxSearch" /> <input type="submit" name="uxSearchSubmit" value="search" /> @(Html.Telerik().Grid(Model) .Name("uxCompanyListGrid") .Columns(columns => { columns.Template( @<text> @(Html.ActionLink("Change", "RequestChange", "Secure", new { companyID = item.companyID }) </text>).Width(60); columns.Bound(i => i.Name); columns.Bound(i => i.CountryOfPublication).Title("Country").Width(100); }) .DataBinding(dataBinding => { dataBinding.Server().Select("CompanyList", "Secure"); }) .Scrollable (s => s.Enabled(true) .Height("500px") ) .Sortable(s => s.Enabled(true)) .Pageable (p => p.Enabled(true) .PageSize(30) ) .Filterable(f => f.Enabled(true)) .Footer(true) )}