Sorting DataGridView by Column.DisplayMember

前端 未结 1 534
孤街浪徒
孤街浪徒 2021-01-15 15:19

I have a DataGridView with a few DataGridViewComboBoxColumn\'s where the actual value is tied to an ID but the DisplayMember is the st

相关标签:
1条回答
  • 2021-01-15 15:35

    Your third attempt is almost right: What you need to do is create an extra column in your DataSet to store the value of the DisplayMember. Then, you create an invisible bound DataGridViewColumn, and bind it to this extra DataSet column. Then it's a bound column, and you can programmatically sort on it.

    The question you've linked to is doing the same, only that solution is generating the display member text in SQL, before it's returned to the application.

    You'd think this'd be simple, wouldn't you? :)

    0 讨论(0)
提交回复
热议问题