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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

checkboxes - how do I change the value?

Thread ID:

Created:

Updated:

Platform:

Replies:

4949 Jun 10,2003 01:49 PM UTC Jun 10,2003 05:07 PM UTC WinForms 4
loading
Tags: GridControl
Tom Langer
Asked On June 10, 2003 01:49 PM UTC

I have a column set as a checkbox, yet I can't change the value by clicking the checkbox.. I can change the CellValue in code, and it sticks, but it won't update the checkbox in the field, nor can I click the checkbox itself (well, I can, it just doesn't toggle the value).

Administrator [Syncfusion]
Replied On June 10, 2003 02:24 PM UTC

Also make sure you have set teh checkboxoptions. This object tells the grid what to consider true and what to consider false for this cell.
this.gridControl1[1,1].CellType = "CheckBox";

this.gridControl1[1,1].CheckBoxOptions = new GridCheckBoxCellInfo("1", "0", "", false);

this.gridControl1[1,1].Text = "1";


this.gridControl1[3,1].CellType = "CheckBox";
this.gridControl1[3,1].CheckBoxOptions = new GridCheckBoxCellInfo("True", "False", "", false);

this.gridControl1[3,1].Text = "True";

If this is not the problem, is this a GriddataBoundGrid or a GridControl you are using?

Tom Langer
Replied On June 10, 2003 04:51 PM UTC

Thanks, this will do the trick. I'm using the plain ol grid.

Tom Langer
Replied On June 10, 2003 05:02 PM UTC

I spoke too soon... I tried out the code and a get an error: An unhandled exception of type 'System.FormatException' occurred in system.dll Additional information: 0 is not a valid value for Boolean. Here's the code I'm using: grdLineItems(tmpRow, 1).CellType = "CheckBox" grdLineItems(tmpRow, 1).CheckBoxOptions = New GridCheckBoxCellInfo("1", "0", "", True) grdLineItems(tmpRow, 1).Text = "0" looks the same as yours.. So I'm guessing some other problem? Any properties in the grid that prevent it from working? It's not readonly, I also know this because I can type free text in other cells.

Tom Langer
Replied On June 10, 2003 05:07 PM UTC

Problem resolved.. The above code DOES work, I just had the value type of the column set to boolean, I set it to string and it's fine now.

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

;