ObjectListView CellEditFinished
ObjectListView - ListView on caffeine, guarana and steroids
Brought to you by:
grammarian
I want to use a custom textbox control to edit a objectlistview row cell. When i try to get the content of the textbox with e.NewValue.ToString() when CellEditFinished event is fired, I see that the content is empty. The code is the following:
At CellEditStarting event
ETextBox tb = new ETextBox(); // I create the control dinamically
tb.Bounds = e.CellBounds;
tb.Text = e.Control.Text.Trim(); //I copy the previous cell value
e.Control = tb;
At CellEditFinished event
string data = e.NewValue.ToString(); // i got empty string
If i use a textbox not customized the e.NewValue contains the value entered. My custom textbox has a "Text" property so e.NewValue returns empty string.
Any Help?
Thanks
Hi everyone. Solved
Only I changed e.NewValue before CellEditFinished event
private void olv_CellEditFinishing(object sender, CellEditEventArgs e)
{
ETextBox tb = e.Control as ETextBox;
if (tb != null)
{
e.NewValue = tb.Text;
}
}