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

Custom Control problem in GridDropDownCellRenderer

Hi,

I am using Syncfusion 4.4.0.51 and .net 2.0 (VS 2005).

I am using a User control in the dropdown by using the GridDropDownCellRenderer. I have created a new DropDownUserCellRenderer by deriving from the GridDropDownCellRenderer. I need to use a list of check boxes in the dropdown. The control has a list of check boxes, a save and cancel button. On save the changed values will be updated in the cell. Cancel will ignore those changes. Also I have created a new cell model DropDownUserCellModel which derives from the GridDropDownCellModel. In my application, i am using the GridControl. For the cell types i am using the DropDownUserCellModel. I have the gridControl present in a model dialog which has an Ok and cancel button. On pressing the cancel button, the values in the first column will be cleared out. The same thing has to happen in Dialog close. The dialog will be shown from the main form(by clicking show button).

The problem I have now is that when closing the dialog, the dropdown cells do not clear all the values even though i place an empty text in the cells. Only the last made changes are not cleared. To simulate this run the application(attached).

1. Click show button in main form.
2. In the new dialog that shows up, all the 4 cells will have drodown cell model.
3. Change vlaues by clicking on the values in first column(say change it to check all the three items in the dropdown list) for both the rows.
4. Now close the dialog and again open it by clicking the show button.
5. Values in one of the rows in first column will be cleared (I have cleared values in both the rows on the first column). The values that are changes last will not be cleared. But If cancel button is pressed, which does call the same method will clear out the changes.

I guess there is a problem with GridDropDownCellModel or GridDropDownCellRenderer when using a custom control inside the cell. Kindly let me know If this is a known issue or Is there any work around for this issue.

Thanks,
Rohith.C

TestDropdownRenderer.zip

4 Replies

GR Golda Rebecal Syncfusion Team August 21, 2007 06:44 AM UTC

Hi Rohith,

When a cell is in edit mode, the changes are stored only in a local cache. Only if it comes out of the Edit mode, the changes are saved. Since the value in the last edited cell is not saved(as it is still in edit mode), clearing the text in the cell will clear only the value that is stored previously and the changed text appears as such in the last edited cell.

To force the changes in the edited cell to be saved, we have to call the EndEdit method.

I have modified the sample you have given and attached it.
http://websamples.syncfusion.com/samples/Grid.Windows/F67479/main.htm

Kindly let me know if this helps you.

Best regards,
Golda


RO Rohith August 21, 2007 12:12 PM UTC

Thanks, This works.


RO Rohith August 23, 2007 06:45 AM UTC

Hi Golda,

I still have this same problem, when I handle the Grid CurrentCellChanged event. I need to get hte changed value when the grid's cell value is changed to do some manipulation. for this I have called the gridControl.CurrentCell.EndEdit() in CurrentCellChanged event. Now when I change something in the cell and close the form that cell's value is not cleared.

Kindly let me know if there is any workaround for this problem.

Thanks
Rohith.C

TestDropdownRenderer.zip


GR Golda Rebecal Syncfusion Team August 25, 2007 12:38 PM UTC

Hi Rohith,

Sorry for the delay in responding.

In order to get the changed cell value in the CurrentCellChanged event, you can use the ControlText property of the CurrentCellRenderer.

private void gridControl1_CurrentCellChanged(object sender, EventArgs e)
{
string changedtext = "";
GridControl grid = sender as GridControl;
if (grid.CurrentCellRenderer != null)
changedtext = grid.CurrentCellRenderer.ControlText;
}

Kindly let me know if this helps you.

Best regards,
Golda

Loader.
Live Chat Icon For mobile
Up arrow icon