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

Bug in CurrentCellValidating?

Thread ID:

Created:

Updated:

Platform:

Replies:

36834 Nov 10,2005 04:28 PM UTC Nov 10,2005 11:07 PM UTC WinForms 3
loading
Tags: GridControl
James Tran
Asked On November 10, 2005 04:28 PM UTC

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.

Administrator [Syncfusion]
Replied On 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

Administrator [Syncfusion]
Replied On 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

Administrator [Syncfusion]
Replied On 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;
	}
}

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

;