My problem is repetitive code: a not so DRY switch statement.
So I have a table with 12 columns that can be ordered by descending or ascending on click. My current solution is the use of a switch statement that checks which column was clicked.
The sortable properties:
This is the page where if a user clicks on a head the table gets ordered:
SortByColumn property comes in a string.
SortAscending boolean comes in from a
You see where this is going? I have 12 columns that can be ordered, so this switch can get very lengthy and unmaintainable. So my question is, is it possible to refactor this with reflection or in some other way?