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

Bug in CurrentCellValidating?

I have Essential Grid v2.1.0.9 and use a grid control with a text field. When the user enters something in the text field and leaves that text field, I get an event so I can save what was entered. I have implemented it as: m_GridControl.CurrentCellValidating += new CancelEventHandler(GridControl_CurrentCellValidating); In my method GridControl_CurrentCellValidating, I have noticed something weird. If I hand enter a value in the text field, I can get that value from m_GridControl.CurrentCell. However, if I cut and paste a value into the text field, I get m_GridControl.CurrentCell = "" (empty string) in my callback method. Why does it give me an empty string on cut and paste? This is a bug.

3 Replies

AD Administrator Syncfusion Team November 10, 2005 06:44 PM UTC

I tried this code in CurrentCellValidating.
private void gridControl1_CurrentCellValidating(object sender, CancelEventArgs e)
{
	Console.WriteLine(this.gridControl1.CurrentCell.Renderer.ControlText);
}
The output was what I expected when I cut from one cell and pasted into another cell. Attached is the sample I used in 2.1.0.9. What are you doing differently?

WindowsApplication70.zip


AD Administrator Syncfusion Team November 10, 2005 10:36 PM UTC

I cut from a cell in Excel 2000 and paste in gridcontrol cell. I ran your example and if you do this, it doesn''t even give you the callback. If you type in something directly on the gridcontrol cell then it works. If you cut from a text editor and paste in the gridcontrol, it also works. It looks like it is Excel which gives it problems. >I tried this code in CurrentCellValidating. >
>private void gridControl1_CurrentCellValidating(object sender, CancelEventArgs e)
>{
>	Console.WriteLine(this.gridControl1.CurrentCell.Renderer.ControlText);
>}
>
>The output was what I expected when I cut from one cell and pasted into another cell. Attached is the sample I used in 2.1.0.9. What are you doing differently? >

WindowsApplication70.zip


AD Administrator Syncfusion Team November 10, 2005 11:07 PM UTC

I think you can avoid this problem by handling teh grid.PasteCellText event.
private void gridControl1_PasteCellText(object sender, Syncfusion.Windows.Forms.Grid.GridPasteCellTextEventArgs e)
{
	if(this.gridControl1.CurrentCell.RowIndex == e.RowIndex
		&& this.gridControl1.CurrentCell.ColIndex == e.ColIndex)
	{
		this.gridControl1.CurrentCell.BeginEdit();
		this.gridControl1.CurrentCell.Renderer.Control.Text = e.Text;
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon