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.

Save a CellValue On the fly

Thread ID:

Created:

Updated:

Platform:

Replies:

80261 Mar 25,2009 11:06 AM Mar 31,2009 09:25 AM Windows Forms 3
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On March 25, 2009 11:06 AM

Hi!

I'm using a ggc and want to Save the cellvalue with every single change (key-event or copy-paste). I started with this:

private void ggc1_TableControlCurrentCellStartEditing(
object sender,GridTableControlCancelEventArgs e) {
e.TableControl.CurrentCell.Model.ActiveTextChanged+=Model_ActiveTextChanged;
}

void Model_ActiveTextChanged(object sender,GridCellEventArgs e) {
GridTextBoxCellModel gtbcm = sender as GridTextBoxCellModel;

// How to save the Cellvalue into the underlying BusinessObject?

}

private void gridGroupingControl1_TableControlCurrentCellEditingComplete(object sender,GridTableControlEventArgs e) {
e.TableControl.CurrentCell.Model.ActiveTextChanged-=Model_ActiveTextChanged;
}

Can anyone help?


Greeting Falk


Rajadurai C [Syncfusion]
Replied On March 26, 2009 11:15 AM

Hi Falk,

Thanks for your interest in Syncfusion products.

The underlying datasource of the grid get updated only when EndEdit is called. This is called by default, when a cell loses focus. If you try to make this call explicitly in your case, the cell will lose focus on typing a single character and cannot allow you to type further continuously which is not a desired behavior.

this.grid.Table.CurrentRecord.EndEdit();
this.grid.Table.EndEdit();


Hence, the underlying data cannot be updated while EndEdit is not called.

Regards,
Rajadurai


Administrator [Syncfusion]
Replied On March 27, 2009 11:58 AM

It can:

void Text_ActiveTextChanged(object sender,GridCellEventArgs e) {
if(gridGroupingControl1.Table.CurrentElement!=null) {
GridTextBoxCellRenderer textRenderer = gridGroupingControl1.TableControl.CurrentCell.Renderer as GridTextBoxCellRenderer;
string text=null;
MyClass ep = gridGroupingControl1.Table.CurrentElement.GetData() as MyClass;
MyClass.MyProperty = textRenderer.ControlText;
}
}


Rajadurai C [Syncfusion]
Replied On March 31, 2009 09:25 AM

Hi Falk,

Thanks for your update. With the provided code, it is possible to get the text in a seperate object on each edit in a cell. But it is not possible to commit the change to the underlying datarow position while editing in that cell. If tried, it will throw NullReferenceException.

If you feel the workaround which you provided satisfies the requirement in your application, please make use of it.

Please let me know if you have any further concerns.

Regards,
Rajadurai


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.

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.

;