This question is locked. New answers and comments are not allowed.
Hello,
I've created a custom binding grid.
View:
Controller:
Everything works properly except that PageSize. This is only working when Ajax binding is executed (show the 5 records I wanted), is that to say, it doesn't work (it shows the default 10 records) when the view is just loaded.
Any idea in how to resolve this?.
Thanks in advance.
Juan
I've created a custom binding grid.
View:
<%= Html.Telerik().Grid(Model.Models)
.Name("Grid")
.PrefixUrlParameters(false)
.Columns(columns =>
{
columns.Bound(o => o.Code).Width(100);
columns.Bound(o => o.ISO3Code).Width(100);
columns.Bound(o => o.CDH).Width(100);
columns.Bound(o => o.Description).Width(400);
columns.Bound(o => o.DisabledDate).Width(100);
}
)
.DataBinding(dataBinding => dataBinding.Ajax().Select("AjaxGrid", "Countries"))
.Pageable(settings => settings.PageSize(Model.PageSize).Total(Model.Total))
.EnableCustomBinding(true)
.Sortable()
.Filterable()
%>
Controller:
public ActionResult Index()
{
return View(new ViewModelCountries
{
Models = GetModels(new GridCommand()),
Total = _repository.Count,
PageSize = 5
}
);
}
[GridAction(EnableCustomBinding = true)]
public ActionResult AjaxGrid(GridCommand command)
{
return Json(new GridModel
{
Data = GetModels(command),
Total = _repository.Count
});
}
Everything works properly except that PageSize. This is only working when Ajax binding is executed (show the 5 records I wanted), is that to say, it doesn't work (it shows the default 10 records) when the view is just loaded.
Any idea in how to resolve this?.
Thanks in advance.
Juan