Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6557401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:04:09+00:00 2026-05-25T13:04:09+00:00

I am having problems with paging a WebGrid. Essentially, I pass the full data,

  • 0

I am having problems with paging a WebGrid. Essentially, I pass the full data, it pages OK. If I limit the data to one page at a time, the paging controls disappear, despite the fact that I have passed in the rowCount.

Why?

See below for setup:

I have a grid defined as follows:

@{
    ViewBag.Title = "Cuentas";
    var grid = new WebGrid(defaultSort: "AccountName", rowsPerPage: 30, canPage: true, 
        ajaxUpdateCallback: "updateGrid");
    grid.Bind(source: Model.Accounts, rowCount: Model.TotalRows);
}

With its columns defined as follows:

<div id="grid">
    @grid.GetHtml(tableStyle:"grid",headerStyle:"head", alternatingRowStyle:"alt", htmlAttributes: new { id = "AccountsGrid"},
        columns:  grid.Columns(grid.Column(header: "", format: (item) => Html.ActionLink("Editar", "Edit", new { id = item.AccountId })),
                                grid.Column(header: "", format: (item) => Html.ActionLink("Eliminar", "Delete", new { id = item.AccountId })),
                                grid.Column("AccountName",header:"Nombre"), 
                                grid.Column("IsClient", header:"Cliente?"), 
                                grid.Column("IsProvider", header:"Proveedor?"), 
                                grid.Column("IsBank", header:"Banco o Caja?"),
                                        grid.Column("Person", format: item => new HtmlString(item.Person == null ? "" : item.Person.Name), header: "Contacto"),
                                        grid.Column("AccountsCostCentress", 
                                            format: item => new HtmlString(item.AccountsCostCentress == null ?
                                            "" : item.AccountsCostCentress.Count.ToString()), header: "Actividades")))
</div>

The ViewModel I am using in my view is defined as follows:

public class AccountsListViewModel
{
    public int PageSize { get; set; }
    public int PageNumber { get; set; }
    public IEnumerable<Account> Accounts { get; set; }
    public int TotalRows {get;set;}
}

This shows that I can pass the rowCount and the IEnumerable Accounts.

Lets say I have 305 rows of accounts. If I set PageSize to 30, that means I will have 11 pages of data (the last one will only have 5 records on it). If Accounts holds all 305 records, the grid works with paging and all.

If Accounts only holds the 30 records corresponding to page 3, for example, the paging control don’t show, EVEN IF TotalRows == 305.

Can’t figure it out. Can you? Or do you know of a blog post, thread or article I might look at??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:04:09+00:00Added an answer on May 25, 2026 at 1:04 pm

    Sorry! Answered my own question:

    autoSortPage: false parameter missing from grid.Bind(…) method.

    See the following SO thread:

    WebGrid paging

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im having problems building a query with the linq to sql data query expression
I'm having some paging issues when I wan't to display the next page with
I am having problems with paging some results drawn from a Mysql database. This
I have a view controller with a paging scrollview displaying pages of data to
I'm trying to do some basic paging in MSSQL. The problem I'm having is
Having problems with a small awk script, Im trying to choose the newest of
Having problems iterating. Problem has to do with const correctness, I think. I assume
Im having problems displaying records to my view when passing viewdata to a user
Im having problems with classpaths. I have used them before with import but I'm
im having problems starting a codeigniter project, the problem is that when i do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.