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
  1. Home
  2. General Programming
  3. C#
  4. Datatable is Sorted (Urgent)

Datatable is Sorted (Urgent)

Scheduled Pinned Locked Moved C#
algorithms
2 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.
  • R Offline
    R Offline
    Roro Adel
    wrote on last edited by
    #1

    Dear all, I need to know given a datatable wether it is sorted or not. I need this to reverse the sorting (i.e. if it is sorted Asc make it Desc and vise verca) Thank u alot. Rania Adel

    C 1 Reply Last reply
    0
    • R Roro Adel

      Dear all, I need to know given a datatable wether it is sorted or not. I need this to reverse the sorting (i.e. if it is sorted Asc make it Desc and vise verca) Thank u alot. Rania Adel

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      When you populate it use ORDER BY column ASC then store a boolean value with the datatable, e.g.

      bool isSortedAsc = true;

      Then, if you need to flip the order you will know which order it is currently in by the Boolean flag. ColinMackay.net Scottish Developers are looking for speakers for user group sessions over the next few months. Do you want to know more?

      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