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,
The following code i am using to copy the all information from gridgroupingcontrol to dataTable.
DataTable dt = new DataTable();
int numCols = grid.TableDescriptor.VisibleColumns.Count;
foreach(GridVisibleColumnDescriptor cd in grid.TableDescriptor.VisibleColumns) {
string s = grid.TableDescriptor.Columns[cd.Name].HeaderText;
dt.Columns.Add(new DataColumn(s, grid.TableDescriptor.Columns[cd.Name].FieldDescriptor.GetPropertyType()));
}
foreach(Record r in grid.Table.FilteredRecords) {
DataRow dr = dt.NewRow();
foreach(GridVisibleColumnDescriptor cd in grid.TableDescriptor.VisibleColumns) {
string s = grid.TableDescriptor.Columns[cd.Name].HeaderText;
dr[s] = r.GetValue(cd.Name);
}
dt.Rows.Add(dr);
}
dt.AcceptChanges();
Q1: I want to copy display member from grid currently it is copying value member.
Please Help me ....!
Thanks, Anna
ADAdministrator Syncfusion Team July 20, 2005 07:57 AM UTC
The data in the record is the valuemember, that is why you see what you do.
One straight forward thing you can do is to look up r.GetValue(cd.Name) in the DataTable (or whatever you are using to provide the look data) and get the display member. If this datasource is a DataTable and you have sorted it on the valuemember column by setting datatable1.DefaultView.Sort = "ValueMemberColName", then use code like:
int pos = dt.DefaultView.Find(r.GetValue(cd.Name));
DataRowView drv = dt.DefaultView[pos];
object displaymemberValue = drv["DisplayMemberColName"];