In order to convert the data from GridControl to GridGroupingControl, please make use of the below code, Code Example 1)In form which contains GridGroupingControl. //To convert the data of GridControl for GridGroupingControl. public void PassData(GridControl grid1) { DataTable dataTable = new DataTable(); int columnCount = grid1.ColCount; for (int i= 1; i <= grid1.ColCount;i++) { dataTable.Columns.Add(string.Format("Column {0}", Convert.ToChar(64 + i))); } for (int i = 1; i <= grid1.RowCount; i++) { DataRow row = dataTable.NewRow(); for (int j = 0; j < grid1.ColCount; j++) { row[j] = grid1[i, j+1].CellValue; } dataTable.Rows.Add(row); } this.gridGroupingControl1.DataSource = dataTable; } 2)From form which contains GridControl private void button1_Click(object sender, EventArgs e) { Form2 form2 = new Form2(); //Passes the GridControl to convert data. form2.PassData(this.gridControl1); form2.Show(); }
|