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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Custom editing and GridDataBoundGrid...

Thread ID:

Created:

Updated:

Platform:

Replies:

910 Sep 3,2002 04:43 AM UTC Sep 3,2002 05:37 AM UTC Windows Forms 1
loading
Tags: GridControl
Sheldon Barr
Asked On September 3, 2002 04:43 AM UTC

I have a data bound grid with a column that uses a custom cell renderer derived from GridStaticCellRenderer. I use a custom control within the renderer to allow editing of the data in the column, which is of type int. How should I go about getting the value from my custom control into the grid model and/or underlying dataset? I've tried updating the underlying dataset directly from the renderer's OnDeactivated() method, but then the grid still shows the old value, not the new value that is correctly stored in the dataset. Is there some object (model?) between the renderer and the dataset that I should set instead, or is there a way to force the renderer to re-render the cell after updating the dataset directly? TIA.

Clay Burch [Syncfusion]
Replied On September 3, 2002 05:37 AM UTC

> I have a data bound grid with a column that uses a custom cell renderer derived from GridStaticCellRenderer. I use a custom control within the renderer to allow editing of the data in the column, which is of type int. > > How should I go about getting the value from my custom control into the grid model and/or underlying dataset? > > I've tried updating the underlying dataset directly from the renderer's OnDeactivated() method, but then the grid still shows the old value, not the new value that is correctly stored in the dataset. > > Is there some object (model?) between the renderer and the dataset that I should set instead, or is there a way to force the renderer to re-render the cell after updating the dataset directly? > > TIA. Saving changed values in normally done in the renderer's OnSaveChanges virtual method. Here is the code that is in the GridCellRendererBase baseclass. protected internal virtual bool OnSaveChanges() { if (CurrentCell.IsModified) { Grid.Model[currentRowIndex, currentColIndex].FormattedText = this.ControlText; return true; } return false; } So, in your renderer code, if you set ControlText and CurrentCell.IsModified to be true when the cell value is changed, this may be all you need to do to tie into the grid's normal updating architecture. If that does not work, you can override OnSaveChanges, and try other code there to save the changed value.

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

;