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

Add CheckBox in dynamic Grid

Thread ID:





77663 Nov 12,2008 12:15 AM UTC Nov 24,2008 02:54 PM UTC ASP.NET Web Forms (Classic) 4
Tags: GridGroupingControl
Carlos Banda
Asked On November 12, 2008 12:15 AM UTC


I want put checkbox in a grid control like a example in your web page (checkboxtemplate.aspx).
But in my case i add grid control dynamically,
i was read your online documentation, but i don't found an example for this case.
Can you would help me with an example. Please.

I have this code lines:

queryString = string.Format("SELECT top 10 * FROM Table1");
using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["xstrconn"].ConnectionString))
SqlCommand command = new SqlCommand(queryString, connection);
SqlDataReader reader = command.ExecuteReader();

xGrid = new GridGroupingControl();
xGrid.DataSource = dt;
xGrid.ShowGroupDropArea = false;
xGrid.TableDescriptor.AllowNew = false;
xGrid.TableDescriptor.AllowEdit = true;
xGrid.ID = "testGrid";
xGrid.PageSize = 0;

GridColumnDescriptor xColumn;
for (int i = 0; i < 5; i++)
xColumn = xGrid.TableDescriptor.Columns[i];

xColumn.MappingName = dt.Columns[i].ColumnName;

xColumn.HeaderText= dt.Columns[i].ColumnName.Replace("_"," ");

VS 2008
grid control

Mohamed Suhaib Fahad A. [Syncfusion]
Replied On November 21, 2008 06:31 AM UTC

Hi Carlos,

Thanks for the details.

Adding up the RowBtnTemplate (as in the Checkbox sample), is pretty much simple. Only thing you need to have a class that implements ITemplate and uses CheckBox as the control,

class CheckBoxTemplate : ITemplate {

#region ITemplate Members

public void InstantiateIn(Control container) {
CheckBox cBox = new CheckBox();
cBox.ID = "ck";
cBox.CheckedChanged += new EventHandler(cBox_CheckedChanged);
cBox.AutoPostBack = true;

void cBox_CheckedChanged(object sender, EventArgs e) {
//Implement the checked changed logic here
CheckBox checkbox = (CheckBox)sender;
GridRow gridrow = (GridRow)checkbox.Parent.Parent;
//implement logic for your code



Please check the following sample that illustrates this,


Let me know if that helps you out.


Carlos Banda
Replied On November 21, 2008 08:18 PM UTC


I try download the example, but the link not work, can you post the correct link?


Rajarajeswari S [Syncfusion]
Replied On November 24, 2008 11:24 AM UTC

Hi Carlos,

Sorry for the inconvenience caused.

Please refer the sample from the above link:


Please try this and let us know if this helps you out.


Carlos Banda
Replied On November 24, 2008 02:54 PM UTC

Thanks, for your help


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