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 8945419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:14:31+00:00 2026-06-15T12:14:31+00:00

WebGrid pagination links work properly in all cases, except one (that I noticed). When

  • 0

WebGrid pagination links work properly in all cases, except one (that I noticed).

When you use CheckBoxFor in MVC, it creates an input[type=hidden] and an input[type=check-box] for the same field so that it can handle state. So, if you have a field named X and submit your form in the GET method, you will end up with an URL like this:

http://foo.com?X=false&X=true

The default model binder can understand these multiple instances os X and figure out it’s value.

The problem occurs when you try to paginate the WebGrid. It’s behavior is to try catch the current request parameters and repass them in the pagination links. However, as there’s more than one X, it will pass X=false,true instead of the expected X=false or X=false&X=true

That’s a problem because X=false,true won’t bind properly. It will trigger an exception in the model binder, prior to the beggining of the action.

Is there a way I can solve it?

EDIT:

It seems like a very specific problem but it’s not. Nearly every search form with a check box will break the WebGrid pagination. (If you are using GET)

EDIT 2:

I think my only 2 options are:

  • Build my own WebGrid pager that is more clever on passing parameters for pagination links
  • Build my own Boolean model binder that understands false,true as valid
  • 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-06-15T12:14:33+00:00Added an answer on June 15, 2026 at 12:14 pm

    In case anybody else is suffering from the issue described, you can work around this using a custom model binder like this:

    public class WebgridCheckboxWorkaroundModelBinder : DefaultModelBinder
    {
        protected override void BindProperty(ControllerContext controllerContext, ModelBindingContext bindingContext, System.ComponentModel.PropertyDescriptor propertyDescriptor)
        {
            if (propertyDescriptor.PropertyType == typeof (Boolean))
            {
                var value = bindingContext.ValueProvider.GetValue(propertyDescriptor.Name);
                if (value.AttemptedValue == "true,false")
                {
                    PropertyInfo prop = bindingContext.Model.GetType().GetProperty(propertyDescriptor.Name, BindingFlags.Public | BindingFlags.Instance);
                    if (null != prop && prop.CanWrite)
                    {
                        prop.SetValue(bindingContext.Model, true, null);
                    }
                    return;
                }
            }
    
            base.BindProperty(controllerContext, bindingContext, propertyDescriptor);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tries to fill webgrid using one answered question and an article , But
I've implemented a WebGrid. Sorting, paging and filtering do not work together. They work
I am able to use WebGrid in any controller like: var grid = new
How do you access a strongly bound complex type in a webGrid within MVC
I am having a similar as the user here: ASP.NET MVC 3.0 WebGrid -
I have a webgrid and for each rows I have a link that I
I Have used WebGrid to take benefit of inbuilt sorting and paging in MVC
I have a WebHelpers WebGrid in MVC 3.0 and would like to custom display
Using an asp.net mvc webgrid, is it possible to render a column using Html.DisplayFor
I have a view that contains a partial view containing a WebGrid that pages

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.