How to swap rows and columns

15 Jun 20211 minute to read

This can be done in GridControl by handling virtual events QueryCellInfo, SaveCellInfo, QueryRowCount, QueryColCount. Here GridControl.Data property is used.

//In the QueryCellInfo handler.
e.Style.ModifyStyle(this.gridControl1.Data[e.ColIndex, e.RowIndex], Syncfusion.Styles.StyleModifyType.Override);

//In the SaveCellInfo handler.
this.gridControl1.Data[e.ColIndex, e.RowIndex] = e.Style.Store;

//In the QueryRowCount handler.
e.Count = this.gridControl1.Data.ColCount;

//In the QueryColCount handler.
e.Count = this.gridControl1.Data.RowCount;
'In the QueryCellInfo handler.
e.Style.ModifyStyle(Me.gridControl1.Data(e.ColIndex, e.RowIndex), Syncfusion.Styles.StyleModifyType.Override)

'In the SaveCellInfo handler.
Me.gridControl1.Data(e.ColIndex, e.RowIndex) = e.Style.Store

'In the QueryRowCount handler.
e.Count = Me.gridControl1.Data.ColCount

'In the QueryColCount handler.
e.Count = Me.gridControl1.Data.RowCount