Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
220
Sorting a special way only when user clicks first header.
posted

Hello. I currently have a custom sort setup.

 

            ultraGridDaySheet.DisplayLayout.Bands[m_DaySheetDataSet.DaySheet.TableName].Columns[m_DaySheetDataSet.DaySheet.TimeColumn.ColumnName].SortIndicator = SortIndicator.Ascending;
            ultraGridDaySheet.DisplayLayout.Bands[m_DaySheetDataSet.DaySheet.TableName].Columns[m_DaySheetDataSet.DaySheet.ApptStateDispCharColumn.ColumnName].SortComparer = new MySortComparer();
            ultraGridDaySheet.DisplayLayout.Bands[m_DaySheetDataSet.DaySheet.TableName].SortedColumns.Add(ultraGridDaySheet.DisplayLayout.Bands[m_DaySheetDataSet.DaySheet.TableName].Columns[m_DaySheetDataSet.DaySheet.ApptStateDispCharColumn.ColumnName], false);
            ultraGridDaySheet.DisplayLayout.Bands[m_DaySheetDataSet.DaySheet.TableName].Columns[m_DaySheetDataSet.DaySheet.ArrivalTimeColumn.ColumnName].SortIndicator = SortIndicator.Ascending;

 

 

What I'd like to accomplish is when the user clicks the first header of columns, I'd like it to be sorted with that code. How would I go about doing this?

 

I've tried the following:

 

        private void ultraGridDaySheet_AfterSortChange(object sender, BandEventArgs e)
        {
            ultraGridDaySheet.DisplayLayout.Bands[m_DaySheetDataSet.DaySheet.TableName].Columns[m_DaySheetDataSet.DaySheet.TimeColumn.ColumnName].SortIndicator = SortIndicator.Ascending;
            ultraGridDaySheet.DisplayLayout.Bands[m_DaySheetDataSet.DaySheet.TableName].Columns[m_DaySheetDataSet.DaySheet.ApptStateDispCharColumn.ColumnName].SortComparer = new MySortComparer();
            ultraGridDaySheet.DisplayLayout.Bands[m_DaySheetDataSet.DaySheet.TableName].SortedColumns.Add(ultraGridDaySheet.DisplayLayout.Bands[m_DaySheetDataSet.DaySheet.TableName].Columns[m_DaySheetDataSet.DaySheet.ApptStateDispCharColumn.ColumnName], false);
            ultraGridDaySheet.DisplayLayout.Bands[m_DaySheetDataSet.DaySheet.TableName].Columns[m_DaySheetDataSet.DaySheet.ArrivalTimeColumn.ColumnName].SortIndicator = SortIndicator.Ascending;
        }

 

But I get an error and crashes when this occurs.

Parents Reply Children
No Data