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
660
Re: WinGrid custom column sorting
posted

When the user clicks a column-header, I needed to sort not only by that column but by two columns (one of them is always the same) so i found this thread and tried it, but i'm getting a NullPointerException

This is my function:

private void DfgridDokumente_BeforeSortChange(object sender, BeforeSortChangeEventArgs e)
{
UltraGridColumn colOverdue = dfgridDokumente.DisplayLayout.Bands[0].Columns["colOverdue"];
if (colOverdue != null)
{
e.SortedColumns.Insert(0, colOverdue, false); //<<-- here i'm getting a null pointer exception
}
}

When i'm in the debugger, colOverdue is set to the correct column, e.SoredColumns looks fine too

Any idea what's going wrong here?