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. Other Discussions
  3. IT & Infrastructure
  4. Sorting problem.

Sorting problem.

Scheduled Pinned Locked Moved IT & Infrastructure
csharptutorialasp-netalgorithmshelp
5 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.
  • K Offline
    K Offline
    kyi kyi
    wrote on last edited by
    #1

    Hi.. My data (before sorting) is like the following. Fig 8 3.5-2 3.4.1-1 Appendix A ------------------ After sorting, it should be 3.4.1-1 3.5-2 Appendix A Fig 8 i m using VS2005, C#.NET and ASP.NET 2.0 Is there anyone to guide me how to sort? thanks in advance! :)

    W 1 Reply Last reply
    0
    • K kyi kyi

      Hi.. My data (before sorting) is like the following. Fig 8 3.5-2 3.4.1-1 Appendix A ------------------ After sorting, it should be 3.4.1-1 3.5-2 Appendix A Fig 8 i m using VS2005, C#.NET and ASP.NET 2.0 Is there anyone to guide me how to sort? thanks in advance! :)

      W Offline
      W Offline
      W Balboos GHB
      wrote on last edited by
      #2

      If you don't mind cheating, you can do the following: - Create a comboBox, or some other such control, with neither dimensions nor visibility - you need some sort of container for your data, anyway. - Set the sort property to true. - Add() your items. - Read them back, when you need them, by their index. - an added bonus to this method is that it will stay sorted if you add more members, but by the same token, indices will change. That caution will be true, however, for any sort method. If you ever upgrade to VS2008, you can use LINQ.

      "The difference between genius and stupidity is that genius has its limits." - Albert Einstein
      "How do you find out if you're unwanted if everyone you try to ask tells you to stop bothering them and just go away?" - Balboos HaGadol

      "It's a sad state of affairs, indeed, when you start reading my tag lines for some sort of enlightenment?" - Balboos HaGadol

      K 1 Reply Last reply
      0
      • W W Balboos GHB

        If you don't mind cheating, you can do the following: - Create a comboBox, or some other such control, with neither dimensions nor visibility - you need some sort of container for your data, anyway. - Set the sort property to true. - Add() your items. - Read them back, when you need them, by their index. - an added bonus to this method is that it will stay sorted if you add more members, but by the same token, indices will change. That caution will be true, however, for any sort method. If you ever upgrade to VS2008, you can use LINQ.

        "The difference between genius and stupidity is that genius has its limits." - Albert Einstein
        "How do you find out if you're unwanted if everyone you try to ask tells you to stop bothering them and just go away?" - Balboos HaGadol

        "It's a sad state of affairs, indeed, when you start reading my tag lines for some sort of enlightenment?" - Balboos HaGadol

        K Offline
        K Offline
        kyi kyi
        wrote on last edited by
        #3

        Thanks for your suggestion. i need to sort the whole datatable based on this field(locator 1)and next one field(locator 2). the datatable has altogether 8 columns. next field is only number. anyway, thank you very much. :)

        W 1 Reply Last reply
        0
        • K kyi kyi

          Thanks for your suggestion. i need to sort the whole datatable based on this field(locator 1)and next one field(locator 2). the datatable has altogether 8 columns. next field is only number. anyway, thank you very much. :)

          W Offline
          W Offline
          W Balboos GHB
          wrote on last edited by
          #4

          No Problem - But a word of advice: You may wish to make your data structure (and source?) information part of your question in the future. As you originally wrote it, it seemed like a simple sort of some data strings. Another thought: since this is a general discussion, you may wish to note the language you're using. My suggestion was language-neutral. A place you can go (without cheaping out on the effort or using LINQ in VS2008) is to check out the STL (which MS actually made usable in VS2005) - at least if you're using C++.

          K 1 Reply Last reply
          0
          • W W Balboos GHB

            No Problem - But a word of advice: You may wish to make your data structure (and source?) information part of your question in the future. As you originally wrote it, it seemed like a simple sort of some data strings. Another thought: since this is a general discussion, you may wish to note the language you're using. My suggestion was language-neutral. A place you can go (without cheaping out on the effort or using LINQ in VS2008) is to check out the STL (which MS actually made usable in VS2005) - at least if you're using C++.

            K Offline
            K Offline
            kyi kyi
            wrote on last edited by
            #5

            thanks .. the data is come from user input. now i can fix this problem. i solved like the following. 1. insert zero in front of numbers. 2. sort by using dataview and put into datatable 3. remove zero and bind with gridview. really thanks. :)

            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