Getting Sort Key / Value of Datagrid

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • am1234
    New Member
    • Feb 2008
    • 1

    Getting Sort Key / Value of Datagrid

    Hello All:

    I have a datagrid in my C# windows application (2.0). I have a routine that is refreshing the datagrid, which is causing it to lose its preselected sort. When this refresh happens, I need to run a method to pull out the sort value so I can re-apply it after the refresh happens but I cannot find out how to pull the sort value from the datagrid.

    Can anyone help me with this?

    Thanks
    Andy
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Is this a DataGrid or a DataGridView? I am going to assume you're using the current DataGridView and not the outdated DataGrid.
    Then there should be an event that gets triggered when a sort happens (ColumnHeaderCl ick maybe?) where you can update some state object to keep track of the sort order?

    Comment

    • kolony
      New Member
      • Feb 2008
      • 2

      #3
      Originally posted by Plater
      Is this a DataGrid or a DataGridView? I am going to assume you're using the current DataGridView and not the outdated DataGrid.
      Then there should be an event that gets triggered when a sort happens (ColumnHeaderCl ick maybe?) where you can update some state object to keep track of the sort order?
      What if it is a Datagrid and not a DataGridView? I have the same issue but do not have a DataGridView to work with. Thanks.

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Originally posted by kolony
        What if it is a Datagrid and not a DataGridView? I have the same issue but do not have a DataGridView to work with. Thanks.
        Then I'm not sure what to tell you, DataGrid was such an awful pain to get to do anything. Once you hit .NET2.0 and higher you get the DataGridView and life gets much easier.

        Did DataGrid even support sorting by clicking columns?

        Comment

        • kolony
          New Member
          • Feb 2008
          • 2

          #5
          Originally posted by Plater
          Then I'm not sure what to tell you, DataGrid was such an awful pain to get to do anything. Once you hit .NET2.0 and higher you get the DataGridView and life gets much easier.

          Did DataGrid even support sorting by clicking columns?
          Unfortunately, it does. Thanks for trying.

          Comment

          Working...