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.
Unfortunately, activation email could not send to your email. Please try again.

GDBG checking all checkboxs in multi selected rows

Thread ID:

Created:

Updated:

Platform:

Replies:

48477 Aug 29,2006 03:06 AM Sep 5,2006 01:01 AM Windows Forms 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On August 29, 2006 03:06 AM

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

Administrator [Syncfusion]
Replied On August 29, 2006 06:43 AM

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

Administrator [Syncfusion]
Replied On September 5, 2006 01:01 AM

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

CONFIRMATION

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.

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.

;