DevExpress: How to preserve XtraGrid group view state in Detail View

960 Views Asked by At

Master Table : DtMaster

enter image description here

Detail Table : DtDetails

enter image description here

DataSet dataset = new DataSet();
dataset.Clear();
dataset.Tables.Add(DtMaster);
dataset.Tables.Add(DtDetails);

DataColumn keycolumn = dataset.Tables[0].Columns["JOB"];
DataColumn foreignkeycolumn = dataset.Tables[1].Columns["JOB"];

if (keycolumn != null && foreignkeycolumn != null)
{
    dataset.Relations.Add("MasterDetailMap", keycolumn, foreignkeycolumn, false);
    GridControlJobMonitor.DataSource = dataset.Tables[0];
    GridControlJobMonitor.ForceInitialize();
}

I get the grid view as shown:

enter image description here

Where Order are grouped by Customer name. I used the RefreshHelperClass.cs file from How to preserve the XtraGrid view state in multilevel master/detail to preserve and load the state. But after refresh I always get the first group in Detail View always expanded while second group always collapsed disregarding its previous condition. In my case I always get Group "Cust C2" always collapsed and group "Cust C1" always expanded.

How to resolve this condition?

0

There are 0 best solutions below