Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
235
Editing Page List Data Type
posted

Is there a way to edit PageSizeList Data Type

cause I wanna use default PageSizeList and just add All for displaying All Records

Parents
No Data
Reply
  • 530
    Offline posted

    Helllo Karen,

    PageSizeList only accepts integer values so that we cannot have a value of other type. In order to have an option to show all the record on the dropdown list, you can calculate the total number of records and add it to PageSIzeList. Below is an example of it. Would you check if this achieves what you are looking for?

    GridModel gridModel = new GridModel();
    gridModel.ID = "grid1";
    gridModel.DataSource = this.Books.AsQueryable();
    var paging = new GridPaging();
    
    // Configure PageSizeList
    paging.PageSizeList.Add(50);
    paging.PageSizeList.Add(100);
    paging.PageSizeList.Add(this.Books.Count); // Get the number of all the records
    
    gridModel.Features.Add(paging);
    return View(gridModel);

Children