This is a migrated thread and some comments may be shown as answers.

[Solved] Binding with Nhibernate

0 Answers 31 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
blang
Top achievements
Rank 1
blang asked on 13 Jul 2011, 10:42 AM
Dear All,

Im want to use nhibernate to bind telerik mvc grid.
im returning a iqueryable object to the grid, but it seems that by each request all records will be returned to the grid.
this is the view:

<%= Html.Telerik().Grid<UserViewModel>()
        .Name("Grid")
        .Columns(columns =>
        {
            columns.Bound(o => o.Id).Width(200);
            columns.Bound(o => o.FirstName);
            columns.Bound(o => o.LastName);
        })
        .Sortable()
        .Filterable()
        .Scrollable()
        .Pageable(p => p.PageSize(20).Total((int)ViewData["total"]))
        .DataBinding(dataBinding => dataBinding.Ajax().Select("_Select", "Users"))
%>

and the controller:

[GridAction]
        public ActionResult _Select(GridCommand command)
        {
            IQueryable<UserViewModel> users = _userService.getallusers();

         

            ViewData["total"] = users.Count();
            return View(new GridModel(users));
        }

how can i fix this issue?

thanks in advance.
Tags
Grid
Asked by
blang
Top achievements
Rank 1
Share this question
or