AV
Avnish
July 19, 2005 06:15 AM UTC
I also tried to capture otherevents like CurrentCellEditingComplete and also try to call functions like EndInit(), confirmChanges(true).
But nothing helps.. I am wondering there is something related to grid property which will solve this problem.
Regards
Avnish
AD
Administrator
Syncfusion Team
July 19, 2005 07:46 AM UTC
>>I am using GridDataBoundGrid and binding the datasource with it. I am attaching few editable columns with it like a Text Box, ComboBox and Checkbox. Strange thing I am facing is that these cells in the grid are not easily editable.
For the TextBox''s, if you do nothing (handle no events, set no properties, etc), the textbox columns should be editable provided the datasource you are using supports editing. This is the simplest thing to check and get working. You should remove all event handlers and properties until this works properly.
For the combobox column, you need to set the GridBoundColumn.StyleInfo.CellType property, and also the DataSource, Displaymember and ValueMember properties (if you are using a foriegn key loopup to provide the information for teh combobox). The thing to check here is the type of the valuemember. The type of the values in your grid''s datasource should be the type of the values in the foreign key datasource valuemember column. If this is set up consistently, and if your grid''s datasource allows editing, then this combobox column should be editable.
Now the checkbox column is a little different. The checkbox column will never have an active state. There is no control sitting in the cell (like a combobox or a textbox). The other thing is to take into consideration is what is the type of the values in your grid datasource for this checkbox column? Are they bool''s true and false values, are they integer 0 and 1''s, are they string Yes and No, or something else. Most of the time when checkboxes do not work, the reason is some inconsistency about what the grid is expecting for the values and what the datatsource is proving for the values. So, in addition to setting style.CellType = "CheckBox", should also set style.CheckBoxOptions so the grid will understand what to except. (You may also need to set style.CellValueType as well though this is normally set by the grid directly from the type of teh data).
So, if you are using bool values, you would set:
gridBoundColumn1.StyleInfo.CellType = "CheckBox";
gridBoundCOlumn1.StyleInfo.CheckBoxOptions = new CheckBoxInfo(true.ToString(), false.ToString(), "", true);
If you have integer 1 and 0''s, you would use:
gridBoundCOlumn1.StyleInfo.CheckBoxOptions = new CheckBoxInfo("1", "0", "", ture);