There is a DataGridView to which the table is bound via the DataSource
dgvManInfo.DataSource = new DataView(ds.Tables["ManInfo"]); A column has been added to the table.
ds.Tables["ManInfo"].Columns.Add("Дата рождения", typeof(string), String.Format("IIF([Birthday] = '{0}', 'Не задано', " + "SUBSTRING(CONVERT([Birthday], System.String), 1, 11))", DATE_DONT_KNOWN)); intended to conveniently display the date or the value "not set" when the date is equal to the specified value.
There is a problem: sorting now works, naturally, in rows!
When clicking on the Дата рождения column, it is necessary to sort by the Birthday column.
Through the event handler, the DataGridView.SortCompare does not work, because
This event occurs only when the P: System.Windows.Forms.DataGridView.DataSource is set and the P: System.Windows.Forms.DataGridView.VirtualMode property value is false.
https://msdn.microsoft.com/ru-ru/library/system.windows.forms.datagridview.sortcompare(v=vs.110).aspx