摘要:2個gridview 排序連動
private void gvFilter_EndSorting(object sender, EventArgs e)
{
//取得第一個gridview排序的所有欄位
DevExpress.XtraGrid.Columns.GridColumnSortInfo[] si = new DevExpress.XtraGrid.Columns.GridColumnSortInfo[gvFilter.SortInfo.Count];
設定第二個gridview要排序的欄位
for (int i = 0; i < gvFilter.SortInfo.Count; i++)
{
si[i] = new DevExpress.XtraGrid.Columns.GridColumnSortInfo(gvDoc.Columns[gvFilter.SortInfo[i].Column.FieldName],
gvFilter.SortInfo[i].SortOrder);
}
//排序資訊指定給第2個gridview
gvDoc.BeginSort();
gvDoc.SortInfo.ClearAndAddRange(si, 0);
gvDoc.EndSort();
gdDoc.RefreshDataSource();
}