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

Template Column Content not rendered after Filter or Paging action

1 Answer 48 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.
Jatin
Top achievements
Rank 1
Jatin asked on 22 Jul 2011, 01:52 PM
Hi,
   I am trying to build a Grid which has a Template Column at the end. I also need to use the Custom Paging and Filtering using Ajax databinding. When the grid is initially loaded, every thing works fine and Template Column (containing a link) renders very well. But when I try to page to or apply Filter, the action completes successfully, but the Template Column no more holds any content (link). Its empty. Here are relevant parts of my code.

<!-- View -->
 
@{Html.Telerik().Grid(Model)
                .Name("UserGrid")
                .Columns(col => {
......
                    col.Bound(m => m.LastName).Title("Last Name");
                    col.Template(@<text>
                                     @Ajax.ActionLink("Details", "UserDetails", new { Id = item.Id },
                                                               new AjaxOptions
                                                               {
                                                                   OnBegin = "beginShowDetails",   
                                                                   OnSuccess = "showDetails",
                                                                   UpdateTargetId = "_UserDetails"
                                                               })
                                                                
                                     </text>).Width(75); 
                     
                })
                .DataBinding(dataBinding => dataBinding.Ajax().Select("_UserList","User"))
                .Pageable(settings => {
                    settings.PageSize(15);
                    settings.Total((int)ViewData["count"]);})
                .EnableCustomBinding(true)
                .HtmlAttributes(new {@class="list-grid"})
                .Filterable()
                .Render();}

/* The Controller */
 
 
        public ActionResult UserList() {
            List<User> users = GetListData(new GridCommand() { PageSize = 15 });
            ViewData["count"] = count;
            return View(users);
        }
 
        [GridAction(EnableCustomBinding=true)]
        public ActionResult _UserList(GridCommand command) {
            List<User> users = GetListData(command);
            return View(new GridModel { Data = users, Total = count });
        }
 
        private List<User> GetListData(GridCommand command) {
            IQueryable<User> users = userManager.GetQueryableUsers();
            users = users.ApplyFiltering(command.FilterDescriptors);
            count = users.Count();
            users = users.OrderBy(u => u.FirstName).ThenBy(u => u.LastName);
            users = users.ApplyPaging(command.Page, command.PageSize);
            return users.ToList();
        }

The extension methods ApplyPaging and ApplyFiltering have been used as per demo here

Any help please.
regard,
NIrvan.

1 Answer, 1 is accepted

Sort by
0
Ankit
Top achievements
Rank 1
answered on 14 Dec 2011, 03:23 AM
Hi

I am also having the same issue. Template column doesn't load data on paging. Did you find any solution?

Thanks
Ankit
Tags
Grid
Asked by
Jatin
Top achievements
Rank 1
Answers by
Ankit
Top achievements
Rank 1
Share this question
or