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

The Grid paging with total number of record

1 Answer 777 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Vadivel asked on 07 Oct 2015, 10:36 AM
Using kendo grid we are able to load the data at the first time. On click of a data from the grid, we are using the ajax call and loading the data to grid on success of the ajax call. On success we have to set the Total paging count, since we are fetching only the required data (10 records per call). But the paging should be available based on the total no record count. On ajax success we are not able to set the Total paging. Kindly provide us the sample code, how to set the paging in grid.

In Index.cshtml view 
    .Columns(columns =>
        columns.Bound(e => e.FolderName).ClientTemplate("# if (FolderName!=null) { #" +
                "<listleft><img title='' src='" + Url.Content("/Content/Images/folder.gif") + "'\"/><file-folder-names><a data-role=\"button\" onclick=\"onClickDoc('#: data.ObjectId#');\" id=\"testa\">#:FolderName#</a></file-folder-names></listleft>"
         "# } #"

    .HtmlAttributes(new { style = "height:400px;" })
    .DataSource(dataSource => dataSource
    .Read(read => read.Action("ReadDataonPaging", "Home").Data("additionalInfo"))
    .Events(events => events.DataBound("dataBound"))

Jquery Ajax call function on click of the row data

function onClickDoc(id) {    
        type: "POST",
        url: "/Home/getValuesonNodeClick",
        data: { node: id, fromIndex: miniCount, toIndex: maxCount }, // the data in JSON format.  Note it is *not* a JSON object, is is a literal string in JSON format
        success: OnGetSelectNodeSuccess,
        error: OnGetMemberError


function OnGetSelectNodeSuccess(datasource1, status) {

    var TestSource = JSON.parse(datasource1);


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 09 Oct 2015, 08:30 AM

Setting the total count via JavaScript is not supported. You should load the data via the dataSource transport and return the total in the response from the server. If different data than the one returned by default from specified read action should be loaded then you could check if the specific parameter is passed with the request and return the needed data.

Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question