Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #13514 |

    Is it possible don’t sort a single column?

    In a DataBound grid I have an empty column, and into I will insert a progressive count. If I sort some columns, also my progressive count will sort.

    Thanks.

    Example:

    |A|B|C|
    b f
    c f
    a f

    For i As Int32 = 0 To Grid1.DataRows.Count – 1
    Grid1.DataRows(i).Cells(“C”).Value = i
    Next

    |A|B|C|
    b f 1
    c f 2
    a f 3

    Grid1.Columns(“A”).SortDirection = SortDirection.Ascending
    For i As Int32 = 0 To Grid1.DataRows.Count – 1
    Grid1.DataRows(i).Cells(2).Value = i
    Next

    |A|B|C|
    a f 3 ?
    b f 1 ?
    c f 2 ?

    I wish:

    |A|B|C|
    a f 1
    b f 2
    c f 3

    Imported from legacy forums. Posted by AndreaZ (had 809 views)

    User (Old forums)
    Member
    Post count: 23064

    Instead of <b>Grid1.DataRows</b>, use <b>Grid1.GetSortedDataRows(True)</b>:<code>Dim rows As Xceed.Grid.Collections.ReadOnlyDataRowList = Grid1.GetSortedDataRows(True)
    For i As Int32 = 0 To rows.Count – 1
    rows(i).Cells(2).Value = i
    Next</code>

    Imported from legacy forums. Posted by Tommy (had 118 views)

    User (Old forums)
    Member
    Post count: 23064

    Thanks! (one more time!)

    No news for this post? 😛

    http://www.xceedsoft.com/Forums/ShowPost.aspx?PostID=2401

    Imported from legacy forums. Posted by AndreaZ (had 305 views)

    User (Old forums)
    Member
    Post count: 23064

    I don’t really see a problem. Could you send me a little Visual Studio project that demonstrates the problem? My e-mail address is [tommy DOT carlier AT weblications DOT be].

    Imported from legacy forums. Posted by Tommy (had 3698 views)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.