Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Problem in selected row after sorting in datagridview

Problem in selected row after sorting in datagridview

Scheduled Pinned Locked Moved C#
questiondatabasealgorithmshelptutorial
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mertli Ozgur Nevres
    wrote on last edited by
    #1

    Hi, i have a problem about datagridview. When i apply a sorting operation on a datagridview, it sortes the items well, but changes the selected item (not selected index). Let me explain this: For example, my sort column's values below: aaa (selected) bbb ccc ddd after sorting: ddd (selected) ccc bbb aaa It changes the selected item. But i want my first selected item will stay in selected. Does anyone know how can i do this? Thanks. ozgur.nevres

    J 1 Reply Last reply
    0
    • M Mertli Ozgur Nevres

      Hi, i have a problem about datagridview. When i apply a sorting operation on a datagridview, it sortes the items well, but changes the selected item (not selected index). Let me explain this: For example, my sort column's values below: aaa (selected) bbb ccc ddd after sorting: ddd (selected) ccc bbb aaa It changes the selected item. But i want my first selected item will stay in selected. Does anyone know how can i do this? Thanks. ozgur.nevres

      J Offline
      J Offline
      Judah Gabriel Himango
      wrote on last edited by
      #2

      Get the item selected before sorting. After sorting, re-select that item. Would that work for you?

      M 1 Reply Last reply
      0
      • J Judah Gabriel Himango

        Get the item selected before sorting. After sorting, re-select that item. Would that work for you?

        M Offline
        M Offline
        Mertli Ozgur Nevres
        wrote on last edited by
        #3

        I did this. I mean, is there any way to do this automatically. A property, or something... I think the answer is no. Thanks for your care. ozgur.nevres

        J 1 Reply Last reply
        0
        • M Mertli Ozgur Nevres

          I did this. I mean, is there any way to do this automatically. A property, or something... I think the answer is no. Thanks for your care. ozgur.nevres

          J Offline
          J Offline
          Judah Gabriel Himango
          wrote on last edited by
          #4

          Not that I know of.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups