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

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

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

1 Reply

AD Administrator Syncfusion Team 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(" ");
	}
}

Loader.
Live Chat Icon For mobile
Up arrow icon