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
close icon

Reg: GridGrouping Control to Datatable

Hi, I am copying data from ggc to datatable. I dont want first 3 columns data.(always) I am using following code to do this. Problem: How may rows are there in the grid that many row are created in the datatable.But data are empty in the dt.(But grid contain data) Any idea..? DataTable dt = new DataTable(); int numCols = grid.TableDescriptor.VisibleColumns.Count; int ii = 0; foreach(GridVisibleColumnDescriptor cd in grid.TableDescriptor.VisibleColumns) { if(ii > 2) { string s = grid.TableDescriptor.Columns[cd.Name].HeaderText; dt.Columns.Add(new DataColumn(s, grid.TableDescriptor.Columns[cd.Name].FieldDescriptor.GetPropertyType())); } ii += 1; } int jj = 0; foreach(Record r in grid.Table.FilteredRecords) { dr = dt.NewRow(); foreach(GridVisibleColumnDescriptor cd in grid.TableDescriptor.VisibleColumns) { if (jj > 2) { string s = grid.TableDescriptor.Columns[cd.Name].HeaderText; dr[s] = r.GetValue(cd.Name); } jj += 1; if (jj == 4) { jj = 0; } } dt.Rows.Add(dr); } dt.AcceptChanges(); Thanks, Anna

1 Reply

AD Administrator Syncfusion Team August 22, 2005 11:19 AM UTC

When you debug your code, what is the first step that does not behave properly? (ie. as you execute your loops, what is the first unexpected value you see?)

Loader.
Live Chat Icon For mobile
Up arrow icon