Sunday, 12 January 2014

How to Add Re-ordering of the columns in Telerik MVC or Razor Grid.

Some times it is required that the column  had to be re-ordered in a grid as, we are using a Telerik grid , as adding the property reorder will do the task.


Here is the code below to do it:

 .Reorderable(reorder => reorder.Columns(true))

  Just add this line to your Telerik Razor grid, it will do the task.


Happy Coding!

How to show the Pager in Telerik Grid both in top and bottom.

While working in a project , my client wants to show the paging in the grid in both in the top of the grid as well as in the bottom of the grid also. As I am using the Telerik grid, it has a property to set while creating the grid. 

So here is the code for it:


.Pageable(p =>
      {
         p.Style(GridPagerStyles.NextPreviousAndNumeric | GridPagerStyles.PageSizeDropDown);    
         p.Position(GridPagerPosition.Both); // this line will do the Magic
         p.PageSize(int.Parse(ViewBag.PageSize ?? "50"), new[] { 10, 20, 50 });
       }).Sortable()
Happy Coding!