I want to extend a dategridview with a (read only) column just for row number. The ROW NUMBER row`s order should not change when datagridview sort by other column content (Like excel)! is possible?
相关问题
- Sorting 3 numbers without branching [closed]
- How to toggle on Order in ReactJS
- Graphics.DrawImage() - Throws out of memory except
- PHP Recursively File Folder Scan Sorted by Modific
- Why am I getting UnauthorizedAccessException on th
We can enumerate each row in one of two ways:
Displaying in Added Column
Credit to ASh for the
CellFormatting
code.Displaying in RowHeader
Note about the
if
statement. The conditione.ColumnIndex == 0
will always preserve numeric order through sorting while the conditionheader.Value == null
will preserve row numbers with the original row (but will need additional code when handling row deletion). For example, this descending sort: