The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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
ADAdministrator 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?)