We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Row Selection Bound to Checkboxes

Thread ID:





74540 Jun 18,2008 04:21 PM UTC Feb 11,2010 12:33 PM UTC ASP.NET Web Forms (Classic) 8
Tags: GridGroupingControl
Administrator [Syncfusion]
Asked On June 18, 2008 04:21 PM UTC


Using 'TableOptions.ListBoxSelectionMode = SelectionMode.MultiSimple' provides very good built in functionality. I just want to modify this slightly:

- The built-in selection behavior is such that the user clicks anywhere on a row to select it, and selection is displayed by highlighting the row.

- I want to use a column of checkboxes for row multi-row selection: The user would select a row via it's cooresponding checkbox. The row would not be highlighted after selection, rather the checkbox is used as a visual indicator that the row has been selected.

Currently, I have a databound gridgrouping control with an unbound column of checkboxes. How do I "hook them up" to the default selection behavior? Or, Is there an easier way to add row selection checkboxes to the grid?

this.GridGroupingControl1.TableDescriptor.VisibleColumns.Move(this.GridGroupingControl1.TableDescriptor.VisibleColumns.IndexOf("Selection"), 0);
var chkBox = new CheckBox();
var template = new CustomItemTemplate();
this.GridGroupingControl1.TableDescriptor.Columns.FindByMappingName("Selection").ItemTemplate = template;

Robert Claypool, Nashville, TN

Rajarajeswari S [Syncfusion]
Replied On June 18, 2008 06:12 PM UTC

Hi Robert,

Thanks for using Syncfusion products.

You can easily achieve your requirement through "RowBtnTemplate". The control which is place dinside the template, will before on each and every row. If we place the Checkbox inside the template and set the ListBoxSelectionMode property to MuliSelect, then by clicking on the checkbox will select the row accordingly.

Please refe the below code snippet which illustartes this:

$TableDescriptor AllowNew="False" AllowFilter="False">
$asp:CheckBox ID="cbRowBtnTemplate" runat="server" OnCheckedChanged="cbRowBtnTemplate_CheckedChanged"
onclick="CheckAll(this);" AutoPostBack="true">


Here "$" is used instead of "<".

Please refer the sample from the below link which illustrates the above:


Please let me know if this helps you out.


Administrator [Syncfusion]
Replied On June 20, 2008 01:26 PM UTC

Thank you for your timely response. The example was very helpful.

I have just a few follow up questions:
- How might I remove the top checkbox that executes CheckAll()?
- I noticed that the example does not work in FireFox 3.0. Do you know when the components will be updated to fix that?

Sincerely, RC

Administrator [Syncfusion]
Replied On June 20, 2008 09:27 PM UTC

Please use the following code to hide the checkbox in the header,

this.GridGroupingControl1.QueryCellStyleInfo += delegate(object sender, GridTableCellStyleInfoEventArgs args)
if ( e.Style.CellType == "RowHeaderCell" )
if ( e.TableCellIdentity.ColIndex == 0 && e.TableCellIdentity.RowIndex == 1 )
e.Style.CellType = "Static";

The Style event would change the type for the first cell that is shown in the column header and thus removing the template from it.

Administrator [Syncfusion]
Replied On June 20, 2008 09:39 PM UTC

this.GridGroupingControl1.QueryCellStyleInfo += delegate(object sender, GridTableCellStyleInfoEventArgs args)
if (args.Style.CellType == "RowHeaderCell")
if (args.TableCellIdentity.ColIndex == 0 && args.TableCellIdentity.RowIndex == 2)
args.Style.CellType = "Static";

Rajarajeswari S [Syncfusion]
Replied On June 23, 2008 06:03 PM UTC

Hi Robert,

1.How might I remove the top checkbox that executes CheckAll()?

Through QueryCellStyleInfo event we can filter the Grid cells according to the cell type, and we can have the CheckBox for a particular cells. Please refer the below code snippet which illustrates this:

protected void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
//Look for the RecordField and AlternateField Cell.
if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)

System.Web.UI.WebControls.CheckBox cb = new CheckBox();
cb.ID = "CheckBox1";
cb.Checked = true;
//Here we adding the DropDownListBox programatically using ITemplate Interface
TemplateClass mytemp = new TemplateClass(cb);
this.GridGroupingControl1.TableDescriptor.RowBtnTemplate = mytemp;

Please refer the sample from the below link which illustartes the above:


2. Support in FireFox 3.0

We have no plans on providing support for FireFox 3.0.

Please let me know if you have any other concerns.


Carlos Guanes
Replied On October 29, 2009 04:47 PM UTC

using your previous sample

How can I map that column to datacolumn?

right now I have under my columns definition:
AllowDropDownCell="False" AllowGroupByColumn="False" AllowSort="False">

Checked="<%# GetChkBoxSendValue(Container) %>" AutoPostBack="True" />

CheckBoxOptions-UncheckedValue="0" />

and what I'm trying to do is to add at the column title a check box, so the user can click there to autocheck all records or do it one per one....



Lakshmi Narasimman G [Syncfusion]
Replied On December 2, 2009 03:23 PM UTC

Hi Carlos,

Thank you for your interest in Syncfusion Products.

We suggest you to use javascript to customize the header row checkbox to check CheckBox in all rows.Please refer online demo from the follwing link


Lakshmi Narasimman G

Mohammad Rafiq
Replied On February 11, 2010 12:33 PM UTC

Is it Possible to do Windows forms?.
i need some sample code to select all checkbox in grid databound control.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon