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

Problem in SaveCellInfo

Thread ID:





101010 Sep 20,2011 06:56 AM UTC Oct 10,2011 06:32 AM UTC WinForms 3
Tags: GridControl
Michal Recka
Asked On September 20, 2011 06:56 AM UTC

I use GridControl based custom grid in UserControl. I want to fire an event with original value (from my datasource) and new value (set in grid) in event SaveCellInfo. If someone refuses changes (event result is false) I need to keep the original value - so I push it into e.Style.CellValue.
Problem is when somebody in the handler method throws e.g. MessageBox (with YES/NO confirmation). The cell looses focus and since then it doesn't matter whatever is in CellValue because the last edited value stays in the cell displayed. Model data is OK. Only problem is with the displayed value which doesn't match the CellValue no matter of CellType (TextBox, ComboBox, ...). If there's no MessageBox to show up everything works fine. Any suggestions?

Asarudheen S [Syncfusion]
Replied On September 27, 2011 04:28 AM UTC

Hi Michal,

Thank you for your interest in Syncfusion products.

Please make use of “ e.Handled = true” in the “SaveCellInfo” event to avoid this problem. It will retained focus to the samec cell if the save action is failed.

Please let me know if I misunderstood your query.


Michal Recka
Replied On October 4, 2011 06:27 AM UTC

Thank you for your answer. I'll try to explain it with some code sample:

private void grid_SaveCellInfo(object sender, GridSaveCellInfoEventArgs e)
CellInfo cell = e.Style.Tag as CellInfo;
if (cell == null || cell.CellProperty == null)

if (!SetPropertyValue(cell.CellProperty, e.Style.CellValue, true, true))
e.Style.CellValue = cell.CellProperty.Value;

e.Handled = true;
grid.RefreshRange(GridRangeInfo.Cell(e.RowIndex, e.ColIndex));

private bool SetPropertyValue(Property property, object value, bool sendValueChangingEvent, bool sendValueChangedEvent)
if (property == null)
throw new ArgumentException("Property can not be null", "property");

if (property.ValueType != typeof(object))
value = Convert.ChangeType(value, property.ValueType);
catch (Exception ex)
Errors.Push(new ErrorStackItem(InfoTypes.Error, Core.StrFormat(Resources.errConvertToType, property.ValueType.FullName), ex, "SetPropertyValue", property, value));

if ((value == null && property.Value != null) || (value != null && !value.Equals(property.Value)))
PropertyValueChangeEventArgs e = new PropertyValueChangeEventArgs(property.Name, property.Value, value);
if (sendValueChangingEvent && PropertyValueChanging != null && !PropertyValueChanging(this, e))
return false;

property.Value = value;
if (sendValueChangedEvent && PropertyValueChanged != null)
PropertyValueChanged(this, e);
return true;

Problem is only when somebody catches an event PropertyValueChanging (my own event) and for example wants user to decide if he wants to accept the change in MessageBox. It doesn't matter if he accepts or not. The TEXT value of cell remains the last displayed text althought the CellValue may be already completely different. (I use also grid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e) with e.Handled = true) Only thing that seems to help is Refresh() of whole grid which is quite overkill.

Asarudheen S [Syncfusion]
Replied On October 10, 2011 06:32 AM UTC

Hi Michal,

Thanks for the update.

We could not able to obtain your actual intention .Could you please share us more information probably a sample or screen shot which shows your problem,which will be more helpful for us to provide a better solution to you?

Appreciate any additional information.



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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

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