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

Find DataType of the column in gridGroupingControl

Hi, On GridGroupingControl.TableControlCurrentCellKeyPress event I want to know the dataype of the column in a gridGroupingControl. can we know the datatype of the column..? If so, how can i loop through all the records and all the columns in the grid..? To loop through all the records I am using foreach (GridRecord rec in this.gridGroupingControl.SyncfusionGridControl.Table.Records) { } How can I loop through all the columns and find out each column datatype dynamically ..? Thanks, Prathima

2 Replies

AD Administrator Syncfusion Team July 7, 2005 05:04 AM

In the current cell key press event, I think this code will get the type of the column:
GridCurrentCell cc = e.TableControl.CurrentCell;
GridTableCellStyleInfo style = e.TableControl.Model[cc.RowIndex, cc.ColIndex];
if(style.TableCellIdentity.Column != null)
{
	Type t = style.TableCellIdentity.Column.FieldDescriptor.GetPropertyType();
	Console.WriteLine(t);
}
If you want to loop through all columns, you can loop through the grid.TableDescriptor.Columns collection using the column.FieldDescriptor.GetPropertyType() to get teh type of each column.


PV Prathima Venkobachar July 7, 2005 07:39 AM

Thanks a lot.It works fine. Prathima

Loader.
Live Chat Icon For mobile
Up arrow icon