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. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Handling checkbox click in GridDataBoundGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

50959 Oct 25,2006 12:46 AM UTC Oct 25,2006 01:33 PM UTC WinForms 2
loading
Tags: GridControl
Dan Garvin
Asked On October 25, 2006 12:46 AM UTC

One column of my databound gdbg is a checkbox. This column is a type bit column in the underlying datatable. When the checkbox is clicked, I want to test the value and if true, update a date in another column on the same row. I'm having trouble getting the value of the checkbox. Following is the code for the CheckBoxClick event:

private void gridLabs_CheckBoxClick(object sender, GridCellClickEventArgs e)
{
//Set complete date if Complete is checked
Int32 col1Idx;
Int32 col2Idx;
gridLabs.CurrentCell.MoveTo(e.RowIndex, e.ColIndex, GridSetCurrentCellOptions.SetFocus);
GridCurrentCell cc = gridLabs.CurrentCell;
col1Idx = gridLabs.Binder.NameToColIndex("testComplete");
col2Idx = gridLabs.Binder.NameToColIndex("dateTestCompleted");
if (e.ColIndex == col1Idx)
{
//TestComplete column
if (cc.Renderer.ControlText == "False")
{
//Test is complete
gridLabs[e.RowIndex, col2Idx].CellValue = DateTime.Now.ToShortDateString();
}
else
{
//Test is not complete; clear date
gridLabs[e.RowIndex, col2Idx].CellValue = DBNull.Value;
}
}

}


I'm sure there's a simple solution. Your help is greatly appreciated. Thanks in advance.

Dan Garvin
Replied On October 25, 2006 12:49 AM UTC

Sorry. Forgot to point out that in the click event, I always get the checkbox value prior to clicking it. So, if it is unchecked and I check it, the .cellvalue or the .renderer.controltext give me "false" instead of the expected true. Thanks.

Dan Garvin
Replied On October 25, 2006 01:33 PM UTC

I've opened a case in Direct-Trac. Thanks.

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.

Warning Icon 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.Close Icon

;