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.

GridBoundColumn - two checkboxes, click on first checked(true), leave the second unchecked

Thread ID:

Created:

Updated:

Platform:

Replies:

77995 Nov 24,2008 02:38 PM Nov 26,2008 05:07 AM Windows Forms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On November 24, 2008 02:38 PM

Hi!
I created two fields on my GridDataBoundGrid, using the GridBoundColumn, when I display on my grid, it´s OK. One field (Accept) side by another field (Reject).

How to that I click on the first field(Accept), turn on checked, he leave the second field(Reject) set unchecked. My intention is just only one field checked on my grid.

Thanks

Ediberto Alves


Jisha Joy [Syncfusion]
Replied On November 26, 2008 05:07 AM

Hi Ediberto,

The intended behavior can be achieved by handling a couple of events. Please refer the code:

this.gridDataBoundGrid1.Model.QueryCellInfo += new GridQueryCellInfoEventHandler(Model_QueryCellInfo);
this.gridDataBoundGrid1.CurrentCellChanged+=new EventHandler(gridDataBoundGrid1_CurrentCellChanged);

private void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
GridModel model = this.gridDataBoundGrid1.Model;
int ColIndex = this.gridDataBoundGrid1.Model.NameToColIndex("Check1");

if (e.RowIndex > 0 && e.ColIndex == ColIndex)
{

if (this.gridDataBoundGrid1.Model[e.RowIndex, e.ColIndex - 1].Text == "True")
{
e.Style.Text = "False";

}
if (this.gridDataBoundGrid1.Model[e.RowIndex, e.ColIndex - 1].Text == "False")
{
e.Style.Text = "True";

}

}


}

private void gridDataBoundGrid1_CurrentCellChanged(object sender, EventArgs e)
{
GridModel model = this.gridDataBoundGrid1.Model;
int ColIndex = this.gridDataBoundGrid1.Model.NameToColIndex("Check");

GridCurrentCell cc= this.gridDataBoundGrid1.CurrentCell;
if(cc.RowIndex > 0 && cc.ColIndex == ColIndex)
{
this.gridDataBoundGrid1.RefreshRange(GridRangeInfo.Cell(cc.RowIndex,cc.ColIndex+1));
}


}

Please try this and let me know if you need further assistance.

Regards,
Jisha


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.

;