In the last article we talked about how to separate out two GridViews each having a column with checkboxes so that checkbox selection from one GridView does not effect the checkbox selection of the other GridView. In this article we are going to demonstrate how to separate out GridView columns. This means we will only check and uncheck a single column of the GridView even though the GridView contains other checkboxes.


Here is the scenario. You have a GridView control and the first column of the GridView control contains checkboxes. You have already implemented a feature to check and uncheck all the checkboxes. If you are not familiar on how to implement this then check out the following article:

Solving Multiple GridViews CheckBox Selection Problem

Everything works fine as expected! The problem arises when you add another column to the same GridView which contains checkboxes. Now, when you click the "chkAll" master checkbox in the first column it will select all the child checkboxes and also any other checkbox that is inside the GridView control in different columns.


The first thing we need to do is to pass in a custom keyword to append with the main column checkboxes that needs to be checked.

In the above code we are passing "chkSelectColumn0" to the toggleCheckBoxes function. The "chkSelectColumn0" is the suffix for the checkboxes in column 0 of the GridView control. These are the checkboxes that we are interested in.

The implementation of the toggleCheckBoxes function is shown below:

The getCheckBoxesFrom function now includes a check for the correct suffix supplied.

And here is the isCorrectSuffix function:

If the checkBoxSuffix is not supplied then it is undefined and we return true to be compliant with the callers that were calling the old function.

Now, if you have a GridView with more then one column with checkboxes you can control which one is activated when you perform the selectAll checkboxes function.


In this article we learned how to resolve the checkbox selection problem which originates when the GridView contains multiple columns with checkboxes. We added a new parameter called "suffix" which targets the column involved in the checkAll function.

[Download Sample]