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

Strange Problems while editing the cells

Hi, 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. I have set ReadOnly property of these columns as false. And my IgnoreReadOnly of gird is false. I tried to make a workaround for the problem hence I captured CurrentCellChanged and CurrentCellChanging events. And put following code. if(fillGrid.CurrentCell.Model.Description != "CheckBox") fillGrid[fillGrid.CurrentCell.RowIndex, fillGrid.CurrentCell.ColIndex].Text = fillGrid.CurrentCell.Renderer.ControlText; Basically if cell is checkbox then control text does not capture its new value. Hence by putting this workaround problem is improved but not to extent that I can deliver this product. Still following things are noticed. 1) Click on the Cell A. Try to change something, if it is a checkbox or combobox nothing happens, currentCellChanging event is fired no matter how many times I tried to edit the cell. if it is a textbox then first time currentCellChanging is fired and after that currentCellChanged is fired hence data is getting modified (because of replacing the cell''s text with control text) but only if I put break point, otherwise only one letter is modified after that it does not allow to edit. I know I might not make senese at this point :( 2)If I click on someother cell in "same row" and again click on original cell then CurrectCellChanged event is fired and i am able to change value in textbox, checkbox and combobox (because of my code) And if I click on some other cell in except one in "same row" then only currentCellChanging is fired and value is not modified (even with my code as controltext does not have new value). Can someone please guide me about what to check on my grid? Regards Avnish

2 Replies

AV Avnish July 19, 2005 01:15 AM

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 02:46 AM

>>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);

Loader.
Live Chat Icon For mobile
Up arrow icon