Hi,
I put some code in the AfterSortChange event and since then the InitializeGroupByRow event doesn't get fired.
If I commen the CONTENT (not the event itself) of AfterSortChange then the InitializeGroupByRow does get fired. This seems very unlogical to me. Can you explain me how this is?
This is the content of AfterSortChange:
private void ctlTaskDataGrid_AfterSortChange(object sender, BandEventArgs e) { if (!this.Sorting) { List<clsSortColumn> SortColsToDelete = new List<clsSortColumn>(); List<clsSortColumn> SortColsToAdd = new List<clsSortColumn>(); for (int i = 0; i < this.DisplayLayout.Bands[0].SortedColumns.Count; i++) { foreach (clsSortColumn sortCol in this.SortColumns) { if (sortCol.Name == ((clsColumn)this.DisplayLayout.Bands[0].SortedColumns[i].Tag).ColumnNameNav) { SortColsToDelete.Add(sortCol); int sequence = sortCol.SortSequence; if (sortCol.TimesClicked == 0) { sequence = this.SortColumns.NextSequence(); } if (sortCol.TimesClicked != 2) SortColsToAdd.Add(new clsSortColumn(((clsColumn)this.DisplayLayout.Bands[0].SortedColumns[i].Tag).ColumnNameNav, (clsColumn)this.DisplayLayout.Bands[0].SortedColumns[i].Tag, this.DisplayLayout.Bands[0].SortedColumns[i].SortIndicator, sequence, (sortCol.TimesClicked + 1))); else SortColsToAdd.Add(new clsSortColumn(((clsColumn)this.DisplayLayout.Bands[0].SortedColumns[i].Tag).ColumnNameNav, (clsColumn)this.DisplayLayout.Bands[0].SortedColumns[i].Tag, SortIndicator.None, -1, 0)); } } } foreach (clsSortColumn oldSortColumn in SortColsToDelete) { if (this.SortColumns.Contains(oldSortColumn)) { this.SortColumns.Remove(oldSortColumn); } } foreach (clsSortColumn newSortColumn in SortColsToAdd) { this.SortColumns.Add(newSortColumn); } if (NoSort == false) this.SetSorting(); } }
Hi Andy,
It's very hard to tell from a code snippet like this what might be going wrong here. Can you duplicate this in a small sample project and post it here so I can take a look?