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. Image for the cookie policy date
close icon

Insert RowBtnTemplate

Insert check box in the main grid, but the two internal grids failed. How should I do?

3 Replies

RP Rekha P Syncfusion Team May 12, 2009 09:59 AM UTC

Hi Nabia,

Thank you for your interest in Syncfusion Products.

I am afraid that I am not able to reproduce the issue reported by you. I have created a simple sample using CheckBox RowBtnTemplate with two Grids to test this issue and it is available in the below link.
http://files.syncfusion.com/support/GGC.Web/7.2.0.20/F81059/main.htm

Please have a look at the above sample and if still the issue exists, could you please try reproducing it in the above sample and send us the modified sample so that we could sort out the cause of the issue and provide you a solution?

Please let me know if you have any other concerns.

Thanks,
Rekha


AD Administrator Syncfusion Team May 13, 2009 05:49 PM UTC

Thanks for the help, solved part of my problem. I gridgroupingcontrol hierarchical (2 grids internal), need to enter the RowBtnTemplate these internal grids and display the check box to check all the lines of the grid. How?


RP Rekha P Syncfusion Team May 14, 2009 01:37 PM UTC

Hi Nabia,

When Parent-Children form of hierarchy Grid is defined, then the checkbox RowBtnTemplate can be specified in the form of checkbox template and binded for both parent and child Grids in QueryCellStyleInfo event. Please refer the code snippet to achieve this.

protected void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)
{
//check for Parent Grid column to bind checkbox.
if (e.TableCellIdentity.Column.Name == "parentID")
{
CheckBox cb = new CheckBox();
cb.ID = "CheckBox1";

//Create a Template by implementing ITemplate interface and assign it to be the ItemTemplate for the column that needs to have a CheckBox.
TemplateClass mytemp = new TemplateClass(cb);
e.TableCellIdentity.Column.ItemTemplate = mytemp;
e.Handled = true;
}
if (e.TableCellIdentity.Column.Name == "childID")
{
CheckBox cb = new CheckBox();
cb.ID = "CheckBox2";

//check for Child Grid column to bind checkbox.
//Create a Template by implementing ITemplate interface and assign it to be the ItemTemplate for the column that needs to have a CheckBox.
TemplateClass mytemp = new TemplateClass(cb);
e.TableCellIdentity.Column.ItemTemplate = mytemp;
e.Handled = true;
}
}
}
public class TemplateClass : ITemplate
{
private Control m_ctrlChildControl = null;
public TemplateClass(Control ctrlChildControl)
{
m_ctrlChildControl = ctrlChildControl;
}

public void InstantiateIn(Control container)
{
container.Controls.Add(m_ctrlChildControl);
}
}

Please refer a sample below which illustrates the above.
http://files.syncfusion.com/support/GGC.Web/7.2.0.20/F81059_1/main.htm

Please let me know if you have any other concerns.

Thanks,
Rekha

Loader.
Live Chat Icon For mobile
Up arrow icon