Datagrid Sorting does not appear to work

0
0

I have each column of my data grid set to Sort = Automatic, but clicking on the header does nothing.

Am I missing some other setting ?

  • You must to post comments
0
0

Okay – after I ran your sample – I figured out that I have to set  column.SortMode = DataGridViewColumnSortMode.Automatic via code after assigning the Datatable to the datasource . Even though some properties from the designer are used like the Data Column Name and Header Text, the Sorting set in the designer did not stick.

This works now. Thanks!

  • You must to post comments
0
0

Hi Edmond,

can you please try simple sample and sort for a non-ID column ?

TIA
Frank

Attachment
  • You must to post comments
0
0

Hi Edmond,

can´t reproduce here. How is your data populated ? Any event handler that might interfer ?
Any chance to wrap it up in a test case ?

Best regards
Frank

  • edmond girardi
    Just retrieving a datatable from database and assigning it to Datagrid data source.
  • Frank (ITG)
    Have you tried using a BindingSource instead ? Regards, Frank
  • edmond girardi
    There is no indication that columns are even sortable – dint it used to show an up or down arrow on the column header ?
  • edmond girardi
    I’m using VS Community 2015
  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.