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

Ado.Net ColChanging event fire twice

Thread ID:

Created:

Updated:

Platform:

Replies:

5665 Jul 13,2003 02:26 PM UTC Jul 13,2003 03:43 PM UTC WinForms 1
loading
Tags: GridControl
Eli Smadar
Asked On July 13, 2003 02:26 PM UTC

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 03:43 PM UTC

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.

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

;