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.

Vinz : How to travels through every cell of a AddNewRecordRow and capture the data ?

Thread ID:

Created:

Updated:

Platform:

Replies:

22635 Dec 16,2004 07:16 PM Dec 17,2004 04:05 AM Windows Forms 1
loading
Tags: GridControl
Vincent Loy Chee Hoon
Asked On December 16, 2004 07:16 PM

Hi, I''m hard time figuring out how to travels through every cell of the AddNewRecordRow of a GridGroupingControl using this ----> ''e'' parameter ( Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCancelEventArgs) contain within the TableControlCurrentCellValidating event The purpose of travels through every of these cells is to check whether all these cells contain empty data. I would really appreciate if anyone can advise me a method which can help me to get this done.thanks :) Best Regards Vincent

Administrator [Syncfusion]
Replied On December 17, 2004 04:05 AM

Here is some code to try. There are 2 cases to consider. One, the cell that was just changed and two, the other cells in the row.
private void gridGroupingControl1_TableControlCurrentCellValidating(object sender, GridTableControlCancelEventArgs e)
{
	GridCurrentCell cc = e.TableControl.CurrentCell;
	GridTableCellStyleInfo style = e.TableControl.Model[cc.RowIndex, cc.ColIndex] as GridTableCellStyleInfo;
	if(style.TableCellIdentity.TableCellType == GridTableCellType.AddNewRecordFieldCell)
	{
		//on a new record
		GridRecordRow newRec = style.TableCellIdentity.DisplayElement as GridRecordRow;
		foreach(GridColumnDescriptor cd in style.TableCellIdentity.Table.TableDescriptor.Columns)
		{
			if(cd.MappingName == style.TableCellIdentity.Column.MappingName)
			{//active cell				Console.WriteLine("{0}=''{1}''", cd.MappingName, cc.Renderer.ControlText);
			}
			else 
			if (newRec.GetData() != null)
			{//other cells

				DataRowView drv = newRec.GetData() as DataRowView;
				if(drv != null)
					Console.WriteLine("{0}=''{1}''", cd.MappingName, drv[cd.MappingName]);
				else
					Console.WriteLine("{0}=''null''", cd.MappingName);
			}
		}
		Console.WriteLine(" ");
	}
}

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.

;