GDBG checking all checkboxs in multi selected rows

Hi,

i am using the GDBG with columns bound to a data set, one of the columns is a checkbox. I need to have the ability that when i select more then one row, clicking one of the selected checkboxs will check all the selected checkboxs and not only the clicked cell.

Regards
Tzvika

2 Replies

AD Administrator Syncfusion Team August 29, 2006 10:43 AM UTC

Hi Tzvika,

This can be done through the CurrentCellChanged event of the grid. Here is some code snippet.

// CurrentCellChanged event handler
GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
int top = this.gridDataBoundGrid1.Selections.Ranges.ActiveRange.Top;
int bottom = this.gridDataBoundGrid1.Selections.Ranges.ActiveRange.Bottom;

if(this.gridDataBoundGrid1.Selections.Ranges.AnyRangeContains(cc.RangeInfo))
{
if(cc.Renderer.StyleInfo.CellType == "CheckBox")
{
bool check = (bool) cc.Renderer.StyleInfo.CellValue;
if(check)
{
for(int i = top ; i <= bottom ; i++)
{
this.gridDataBoundGrid1.Model[i, cc.ColIndex].CellValue = true;
}
}
}
}

Here is a sample demonstrating this feature.
http://www.syncfusion.com/Support/user/uploads/CheckBoxSample_b750159e.zip

Thanks for using Syncfusion Products.
Regards,
Rajagopal


AD Administrator Syncfusion Team September 5, 2006 05:01 AM UTC

thanks it works perfectly :)

>Hi Tzvika,

This can be done through the CurrentCellChanged event of the grid. Here is some code snippet.

// CurrentCellChanged event handler
GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
int top = this.gridDataBoundGrid1.Selections.Ranges.ActiveRange.Top;
int bottom = this.gridDataBoundGrid1.Selections.Ranges.ActiveRange.Bottom;

if(this.gridDataBoundGrid1.Selections.Ranges.AnyRangeContains(cc.RangeInfo))
{
if(cc.Renderer.StyleInfo.CellType == "CheckBox")
{
bool check = (bool) cc.Renderer.StyleInfo.CellValue;
if(check)
{
for(int i = top ; i <= bottom ; i++)
{
this.gridDataBoundGrid1.Model[i, cc.ColIndex].CellValue = true;
}
}
}
}

Here is a sample demonstrating this feature.
http://www.syncfusion.com/Support/user/uploads/CheckBoxSample_b750159e.zip

Thanks for using Syncfusion Products.
Regards,
Rajagopal

Loader.
Up arrow icon