Telerik Forums
UI for ASP.NET MVC Forum
1 answer
62 views

Hi,

I wanted to Customize Kendo Grid Pagination as per the screenshot below. 

I tried the paging properties but nothing works.

I want the pagination style from 

 

 

To this

Anton Mironov
Telerik team
 answered on 04 Mar 2025
1 answer
354 views

This problem was introduced when I upgraded to 2023.3.1010

 

The grid control renders it's pager like this:


<a aria-label="Refresh" class="k-pager-refresh k-link" href="/Home/Paging_Orders" title="Refresh">
     <span class="k-icon k-i-arrow-rotate-cw"></span>
</a>

Note the icon. If it was using FONT icons, it should have the class k-icon-font as well as the other classes.
If it was using SVG icons, it should have an embedded SVG inside it.

But it has neither, so there is nothing displayed at all.

I went to the online demonstration page https://demos.telerik.com/aspnet-mvc/grid/paging. Once you click the checkbox to display the refresh button, it renders the button correctly as an SVG icon.

<span class="k-icon k-svg-icon k-svg-i-arrow-rotate-cw k-button-icon">
      <svg aria-hidden="true" focusable="false" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="M480 288c0 123.7-100.3 224-224 224S32 411.7 32 288 132.3 64 256 64V0l160 96-160 96v-64c-88.2 0-160 71.8-160 160s71.8 160 160 160 160-71.8 160-160c0-29.1-7.8-56.4-21.5-80l55.5-32c19.1 32.9 30 71.2 30 112z"></path></svg>
</span>

I do not understand what this demo is doing that my code is not.

Here is how I am creating the grid:


@( Html.Kendo().Grid<FromAspnetFrameworkTemplate.Models.OrderViewModel>() .Name("Grid") .Columns( columns => { columns.Bound(o => o.OrderID); columns.Bound(o => o.ContactName); columns.Bound(o => o.ShipAddress); columns.Bound(o => o.OrderDate).Format("{0:d}"); columns.Bound(o => o.ShipCountry); } ).Pageable( pager => pager.PageSizes(new[] { 10, 20, 30 }).Refresh(true).Responsive(false) ).DataSource(dataSource => dataSource .Ajax() .Read(read => read.Action("Paging_Orders", "Home")) ) )

 

I am using the following Nuget packages:

  • Telerik.UI.for.AspNet.Mvc5, 2023.3.1010
  • Telerik.FontIcons, 2.0.0
  • Telerik.SvgIcons, 2.0.0

I am including the styles and scripts like so:


<link href="https://kendo.cdn.telerik.com/themes/7.0.1/default/default-main.css" rel="stylesheet" />
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
<script src="~/Scripts/kendo/2023.3.1010/kendo.all.min.js"></script>
<script src="~/Scripts/kendo/2023.3.1010/kendo.aspnetmvc.min.js"></script>


Eyup
Telerik team
 answered on 03 Nov 2023
1 answer
98 views

I'm using a k-grid with an items per page dropdown, it initially loads correctly but when a new value is selected then the pager elements are hidden. 

Anton Mironov
Telerik team
 answered on 25 Oct 2023
1 answer
146 views

I display grids with a page size control. In one page within my project it still looks fine - and this is where I create the grid using kendo ui for JQuery.

In the instances when I create it using MVC, there are styling errors. (See in the image how the number "10" is truncated.)

After much drilling into the HTML, I found the difference in how the Razor library creates the HTML elements, as opposed to how the JQuery creates the HTML elements.

JQuery generates the following element structure. Note that the k-pager-sizes element comes after the k-pager-numbers-wrap element

<div class="k-pager k-grid-pager k-pager-md"> <!-- The pager bar -->
     <div class="k-pager-numbers-wrap">
             <!-- ... -->
     </div>
     <span class="k-pager-sizes k-label">
            <!-- The page-size picker goes here -->
     </span>
</div>

In contrast, the Kendo Razor libraries generates the following element structure, where the k-pager-sizes element falls inside the k-pager-numbers-wrap element:

<div class="k-pager k-grid-pager k-pager-md"> <!-- The pager bar -->

     <div class="k-pager-numbers-wrap">
             <!-- ... -->
            <span class="k-pager-sizes k-label">
                  <!-- The page-size picker goes here -->
             </span>
     </div>

</div>

This breaks the styling. There is styling rule that imposes a minimum width on all buttons under .k-pager-numbers-wrap. This makes the drop-down arrow too wide, which causes the page size number to truncate.


    @each $size, $size-props in $kendo-pager-sizes {
        $_padding-x: k-map-get($size-props, padding-x);
        $_padding-y: k-map-get($size-props, padding-y);
        $_item-group-spacing: k-map-get($size-props, item-group-spacing);
        $_item-min-width: k-map-get($size-props, item-min-width);
        $_pager-dropdown-width: k-map-get($size-props, pager-dropdown-width);

        .k-pager-#{$size} {
            padding-inline: $_padding-x;
            padding-block: $_padding-y;
            gap: $_item-group-spacing;

            .k-pager-numbers-wrap {
                .k-button {
                    min-width: $_item-min-width;
                }

 

After writing this, I realize it might be more appropriate as a logged defect, which I've done here:

https://feedback.telerik.com/aspnet-mvc/1621268-kendo-razor-controls-renders-grid-pager-differently-to-kendoui-for-jquery-breaks-styling

 

 

Andrew
Top achievements
Rank 1
Iron
Iron
 answered on 30 Aug 2023
0 answers
290 views

i have a kendo grid which has .pageable.pageSizes(new[] {20,50,100,250})

when i try and select a page size from the drop down list i get an error:

this is the code that sets up the grid

as a result of the error the page size isnt updated.

 

 

NOTE: THIS HAS BEEN FIXED, IT WAS AN ISSUE WITH A HEAD SCRIPT

Daniel
Top achievements
Rank 1
 updated question on 02 Feb 2023
1 answer
142 views

I have an issue with my page where everything works fine except it will not go to pages 3, 5, and 11.  My datasource is a list of an object in my model.  I can add, save, anything except go to those pages.  Below is my code from the page. I am using Kendo 2020.3.1118 (don't have a license for anything newer).  If I click on the 3, nothing happens if I am on page 2 and click the next page arrow, nothing happens. If I am on page 4 and click the next page arrow nothing happens.  But if I am on page 6 and click it, I go to 7, then 8, etc. until I get to 10.  It only refuses those 3 pages out of the 12 that it creates for my data.  The counter on the bottom right works fine.  And if I take out the pageable ability, my dropdown quits working.  I have only been using Kendo for about a week or so.  Once I get this figured out, this project will actually be complete.  It is the last issue I have to solve.  Any help would be greatly appreciated.  

 @(Html.Kendo().Grid(Model).Name("EditableGrid")
                    .Columns(c =>
                    {
                        c.Command(command => command.Custom("Save").SendDataKeys(true).Click("sendLO2")).Width(95);
                        //c.Command(command => { command.Edit(); }).Width(150);
                        c.Bound(f => f.ID).Title("ID").Width(95);
                        c.Bound(f => f.LoanOfficerID).Title("Loan OfficerID").Width(100);
                        c.Bound(f => f.FullName).Title("Full Name").Width(125);
                        c.Bound(f => f.FirstName).Title("First Name").Width(125);
                        c.Bound(f => f.LastName).Title("Last Name").Width(125);
                        c.Bound(f => f.ReceivingLoanOfficerID).Title("Receiving Loan OfficerID").Width(150);
                        c.Bound(f => f.ReceivingFullName)
                            .ClientTemplate("#=ReceivingFullName.rcvFullName#")
                            .Title("Receiving Full Name")
                            .EditorTemplateName("OptionsLOs")
                            .Sortable(false)
                            .Width(180);
                        c.Bound(f => f.ReceivingFirstName).Title("Receiving First Name").Width(125);
                        c.Bound(f => f.ReceivingLastName).Title("Receiving Last Name").Width(125);
                        c.Bound(f => f.Active).Title("Active").Width(95);
                        c.Bound(f => f.CreatedDate).Title("Created Date").Width(125);
                        c.Bound(f => f.ReceivingEmployeeID).Title("Receiving EmployeeID").Width(125);
                        c.Bound(f => f.ReceivingLOID).Title("Receiving LOID").Width(125);
                        c.Bound(f => f.ReceivingTitle).Title("Receiving Title").Width(125);
                        c.Bound(f => f.ReceivingNMLSID).Title("Receiving NMLSID").Width(125);
                        c.Bound(f => f.ReceivingMobileNumber).Title("Receiving Mobile Number").Width(125);
                        c.Bound(f => f.ReceivingOfficeNumber).Title("Receiving Office Number").Width(125);
                        c.Bound(f => f.ReceivingEmailAddress).Title("Receiving Email Address").Width(125);
                        c.Bound(f => f.ReceivingWebsite).Title("Receiving Website").Width(150);
                        c.Bound(f => f.ReceivingBranchID).Title("Receiving BranchID").Width(125);
                        c.Bound(f => f.ReceivingTandemTeamID).Title("Receiving Tandem TeamID").Width(125);
                        c.Bound(f => f.ReceivingOriginationTeamID).Title("Receiving Origination TeamID").Width(125);
                        c.Bound(f => f.ReceivingPictureURL).Title("Receiving Picture URL").Width(150);
                        c.Bound(f => f.ReceivingQRCodeURL).Title("Receiving QRCode URL").Width(150);
                        c.Bound(f => f.ReceivingActive).Title("Receiving Active").Width(95);
                        c.Bound(f => f.ReceivingDateCreated).Title("Receiving Date Created").Width(125);
                        c.Bound(f => f.ReceivingCreatedBy).Title("Receiving Created By").Width(125);
                    })
                    .ToolBar(toolbar => toolbar.Create())
                    .Editable(editable => editable.Mode(GridEditMode.InCell))
                    .Pageable()
                    .Sortable()
                    .Scrollable()
                    .Filterable()
                    .HtmlAttributes(new { style = "height:650px;" })
                    .DataSource(DataSource => DataSource
                            .Ajax()
                            .PageSize(50)
                            .ServerOperation(false)
                            .Update(update => update.Action("SaveLO", "Home"))
                            .Create(update => update.Action("SaveLO", "Home"))
                            .Model(model =>
                            {
                                model.Id(p => p.ID);
                                model.Field(p => p.ReceivingFullName).DefaultValue(ViewData["defaultLO"] as Nova.ReceivingLO_LO.MVC.Models.LOOptions);
                            })

                        )
                    .Resizable(resize => resize.Columns(true))
        )
Daniel
Top achievements
Rank 1
Iron
 answered on 23 Dec 2022
1 answer
1.1K+ views

We have a Kendo grid that can display anywhere from 10 to thousands of rows.  We want to be able to set the grid page size to several values, including ALL.

What we have now - without ALL works:

.Pageable(p => p
     .PageSizes(new[] { 100, 200, 500, 1000, 2000 })

When we run this - we see the correct values in the "Items per page" dropdown.

We want to add the "All" option to this dropdown, but the following is not working (compile error)
.Pageable(p => p
     .PageSizes(new[] { 100, 200, 500, 1000, 2000, "All" })

How do we include All along with other values in the Items per page?

 

Eyup
Telerik team
 answered on 20 Jul 2022
0 answers
413 views

Hello,

I am working on Kendo Grid and wants to perform all operation server side.

For now, everything is working, except, when I call Read action and find the correct page number, and set it on the DataSourceResult, the object is found on the Grid, Selected and Highlighted as expected,
but the UI Pager value always shows 1/set to 1, no matter what Page value I have set in the DataSourceResult.

Below is my cshtml code:

@(Html.Kendo().Grid<dynamic>()
      .Name($"Grid_{Model.Name}")
      .Columns("Some Columns")
      .Pageable(Model.Pager)
      .Filterable(ftb => ftb
         .Mode(GridFilterMode.Row)
      )
      .DataSource(dataSource => dataSource
         .Ajax()
         .Read(read => read.Action("GetBrowseResults", Model.Controller, new { area = string.Format("Module/{0}", Model.Controller), theTypeToBrowse = Model.TypeToBrowse, theGroupObj = Model.IsGroupType }))
         .PageSize(Model.IsTouchDevice ? 20 : 100)
      .ServerOperation(true)
      )
      .Events(events => events.Change("LibraryRecordSelected").DataBound("LibraryDataBound"))
)

 

And here is the C# code:

public ActionResult GetBrowseResults([DataSourceRequest] DataSourceRequest theRequest, string theTypeToBrowse, string theGroupId, bool theGroupObj)
      {
         var browseResult = GetBrowseResults(theTypeToBrowse, theGroupId, theGroupObj);

         if (browseResult != null)
         {
            var ret = FilterBrowseModel(browseResult, theRequest);
            var result = Json(ret.Item1.ToDataSourceResult(ret.Item2));
            result.MaxJsonLength = int.MaxValue;
            return result;
         }
      }
          
public (List<BrowseModel>, DataSourceRequest) FilterBrowseModel(IEnumerable<BrowseModel> theBrowseModel, DataSourceRequest theDataSourceRequest)
      {
         var ret = new List<BrowseModel>();
         int total = theBrowseModel?.Count() ?? 0;

         if (total > 0)
         {
            bool reset = true;

            if (theDataSourceRequest.Page > 0 && theDataSourceRequest.PageSize > 0)
            {
                  var objectData = GetObjectData(HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString());
                  if (objectData?.ObjectTxt != null)
                     theDataSourceRequest.Page = (theBrowseModel.ToList().FindIndex(x => x.ObjectTxt == objectData.ObjectTxt)) / theDataSourceRequest.PageSize + 1;
            }

            if (reset)
               ret.AddRange(theBrowseModel);
         }

         return (ret, theDataSourceRequest);
      }


Ammad
Top achievements
Rank 1
 asked on 07 Mar 2022
1 answer
106 views
Can anyone point me in the right direction on how to perform server side paging using razor syntax?  I can't seem to find any documentation that demonstrates how to do this using razor syntax for the example.
Anton Mironov
Telerik team
 answered on 29 Sep 2021
1 answer
121 views
Is there a way to set this property globally for an entire ASP.Net project/solution?
Anton Mironov
Telerik team
 answered on 26 Aug 2021
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
ListView (Mobile)
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
AppBar
BottomNavigation
Card
FloatingActionButton
Licensing
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
DateTimePicker
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?