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. Web Development
  3. ASP.NET
  4. shorting in gridview

shorting in gridview

Scheduled Pinned Locked Moved ASP.NET
databasequestion
6 Posts 3 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.
  • D Offline
    D Offline
    Dhyanga
    wrote on last edited by
    #1

    Hi, I am using gridview to show my data from the database. I have autoGeneratedColumns set to false but I do need the shorting properties by date. I set allowShorting to true. I have fields like date and FirstName. Is it possible that i can short either by date or FirstName both. Like whenever user select by date, it should be shorted by date and whenever user selects by FirstName, it should short accordingly. Can I be able to do that ?

    suchita

    L 1 Reply Last reply
    0
    • D Dhyanga

      Hi, I am using gridview to show my data from the database. I have autoGeneratedColumns set to false but I do need the shorting properties by date. I set allowShorting to true. I have fields like date and FirstName. Is it possible that i can short either by date or FirstName both. Like whenever user select by date, it should be shorted by date and whenever user selects by FirstName, it should short accordingly. Can I be able to do that ?

      suchita

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      The GridView class has a Sort method, so you can easily sort programmatically. What you need to do is choose a way for the user to request the different ways of sorting you want; maybe add a few buttons? :)

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

      Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

      D 1 Reply Last reply
      0
      • L Luc Pattyn

        The GridView class has a Sort method, so you can easily sort programmatically. What you need to do is choose a way for the user to request the different ways of sorting you want; maybe add a few buttons? :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

        Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

        D Offline
        D Offline
        Dhyanga
        wrote on last edited by
        #3

        Thanks for the reply. Ya I did use sort method but I want to have two columns sorting. For example, there are two columns ID and Name , then when user clicks ID, it should sort with ID and when user clicks Name, it should sort with Name. Is there any way to do that ?

        suchita

        L S 2 Replies Last reply
        0
        • D Dhyanga

          Thanks for the reply. Ya I did use sort method but I want to have two columns sorting. For example, there are two columns ID and Name , then when user clicks ID, it should sort with ID and when user clicks Name, it should sort with Name. Is there any way to do that ?

          suchita

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          I'm somewhat familiar with DataGridView (in WinForms), not with DataGrid. However, have a look at DataGridColumn.SortExpression, I think it is the key to what you want. :)

          Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

          Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

          1 Reply Last reply
          0
          • D Dhyanga

            Thanks for the reply. Ya I did use sort method but I want to have two columns sorting. For example, there are two columns ID and Name , then when user clicks ID, it should sort with ID and when user clicks Name, it should sort with Name. Is there any way to do that ?

            suchita

            S Offline
            S Offline
            sashidhar
            wrote on last edited by
            #5

            SayamiSuchi wrote:

            , then when user clicks ID, it should sort with ID and when user clicks Name

            Its rally a good thing to implement.You Have to handle programatically..! may be the below article may help..! http://dotnetslackers.com/articles/gridview/SortingaGridviewwithmultipleColumns.aspx If u have any more problems let me know:thumbsup:

            LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

            D 1 Reply Last reply
            0
            • S sashidhar

              SayamiSuchi wrote:

              , then when user clicks ID, it should sort with ID and when user clicks Name

              Its rally a good thing to implement.You Have to handle programatically..! may be the below article may help..! http://dotnetslackers.com/articles/gridview/SortingaGridviewwithmultipleColumns.aspx If u have any more problems let me know:thumbsup:

              LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

              D Offline
              D Offline
              Dhyanga
              wrote on last edited by
              #6

              thanks. I got it work already.

              suchita

              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