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.

Ado.Net ColChanging event fire twice

Thread ID:

Created:

Updated:

Platform:

Replies:

5665 Jul 13,2003 10:26 AM Jul 13,2003 11:43 AM Windows Forms 1
loading
Tags: GridControl
Eli Smadar
Asked On July 13, 2003 10:26 AM

I am working with a GridDataBoundGrid bound to Data Table. While working on the grid and changing cell content, the ColChanging and ColChanged events fire once when i change the value in a cell and a second time when changing row. I am trying to have some logic between cells in the same row (Quatity, UnitPrice, Total Price) and this behaviour is changing the data twice making unexpected mistakes. Any Suggestions? Thanks, Eli

Administrator [Syncfusion]
Replied On July 13, 2003 11:43 AM

I am not sure whether this will work in your case, but you can try doing your work once by identifying when you are getting the ColumnChanging from with RowLeave. Below are some code snippets showing how this might be done.
private bool inRowLeave = false;
private void gridDataBoundGrid1_RowLeave(object sender, GridRowEventArgs e)
{
	inRowLeave = true;
}

private void gridDataBoundGrid1_RowEnter(object sender, GridRowEventArgs e)
{
	inRowLeave = false;
}

private void datatable_ColumnChanging(object sender, DataColumnChangeEventArgs e)
{
	if(!inRowLeave)
		Console.WriteLine("datatable_ColumnChanging " + e.Column.ToString() );
}

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.

;