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

Reg: GridGroupingControl

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

3 Replies

AD Administrator Syncfusion Team July 20, 2005 02:57 AM

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"];


AS Anna Srinivasan July 21, 2005 03:40 AM

Hi, can you please do the same modification in the sample code and send it to me.B''cause i got little confusion. Copy data from grouping grid to datatableggc_DT_b3e8e41f_3160.zip


AD Administrator Syncfusion Team July 21, 2005 04:28 AM

I do not understand. Your sample does not have any column using a displaymember/valuemember. Did you upload the right sample?

Loader.
Live Chat Icon For mobile
Up arrow icon