[HELP] Sorting a gridview based on the values of two different columns
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: [HELP] Sorting a gridview based on the values of two different columns

Hybrid View

  1. #1
    Join Date
    Aug 2011
    Posts
    2

    [HELP] Sorting a gridview based on the values of two different columns

    I have a datagrid I will call Cancel

    The three fields I need to sort in this datagrid are Column 0(Type) and Column 6 (Number) Column 7(ParentNumber).

    The column 0 can have 4 different value
    Parent
    Child
    Orphan
    (Blank)
    Column 7 have a infinite number of possibilities.

    For items that have a Parent and Child in the datadrid I need to keep those grouped together with the Parent being first and the all the child records following

    You know they should be grouped together because Column 6 and column 7 would equal each other.

    Orphan specs would come next in the overal list being that Column 7 does not match the value of any of them items in column 6

    and the next would be Blank items meaning

    EX

    0...................6 7
    Parent 1
    Parent 2
    Child 20 1
    Child 30 1
    Child 40 1
    Child 50 2
    Child 60 2
    Child 70 2
    Orphan 100 5
    Orphan 200 6
    Orphan 300 7
    (Blank) 1000




    I would need the order to display in the datagrid
    Parent 1
    Child 20 1
    Child 30 1
    Child 40 1
    Parent 2
    Child 50 2
    Child 60 2
    Child 70 2
    Orphan 100 5
    Orphan 200 6
    Orphan 300 7
    (Blank) 1000

  2. #2
    Join Date
    Aug 2011
    Posts
    2

    Re: [HELP] Sorting a gridview based on the values of two different columns

    EX - this didn't work right up at the top.. Also this is a windows form

    0...................6..... 7
    Parent........... 1.....
    Parent........... 2.....
    Child ...........20..... 1
    Child ...........30..... 1
    Child ...........40..... 1
    Child ...........50..... 2
    Child ...........60..... 2
    Child ...........70..... 2
    Orphan .......100.... 5
    Orphan .......200.... 6
    Orphan .......300.... 7
    (Blank) .......1000....




    I would need the order to display in the datagrid
    Parent.............1.....
    Child ..............20..... 1
    Child ..............30..... 1
    Child ..............40..... 1
    Parent.............2.....
    Child ..............50..... 2
    Child ..............60..... 2
    Child ..............70..... 2
    Orphan ...........100... 5
    Orphan ...........200... 6
    Orphan ...........300... 7
    (Blank) ...........1000..

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center