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

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

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


1 Reply

JJ Jisha Joy Syncfusion Team November 26, 2008 10:07 AM UTC

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


Loader.
Live Chat Icon For mobile
Up arrow icon