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. Web Development
  3. ASP.NET
  4. Show only 'A' items in gridview

Show only 'A' items in gridview

Scheduled Pinned Locked Moved ASP.NET
question
6 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.
  • T Offline
    T Offline
    Terick
    wrote on last edited by
    #1

    Hi, I have a gridview that is sorted alphabetically and has a header that allows the user to sort through the items by clicking on a letter. How do I set the gridview so that on the page load, only the items that start with 'A' are shown? Thanks!

    C 1 Reply Last reply
    0
    • T Terick

      Hi, I have a gridview that is sorted alphabetically and has a header that allows the user to sort through the items by clicking on a letter. How do I set the gridview so that on the page load, only the items that start with 'A' are shown? Thanks!

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Set your data source to only return items starting with A

      Christian Graus Driven to the arms of OSX by Vista.

      T 1 Reply Last reply
      0
      • C Christian Graus

        Set your data source to only return items starting with A

        Christian Graus Driven to the arms of OSX by Vista.

        T Offline
        T Offline
        Terick
        wrote on last edited by
        #3

        How do I do that? I am using a user control so that one the first screen all of the items are available, but only those starting with the letter A are shown unless the user sorts the gridview. On all subsequent pages, however, only the selected items are shown, and all of those must appear.

        C 1 Reply Last reply
        0
        • T Terick

          How do I do that? I am using a user control so that one the first screen all of the items are available, but only those starting with the letter A are shown unless the user sorts the gridview. On all subsequent pages, however, only the selected items are shown, and all of those must appear.

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          you don't want full alphabetisation, just to show the As on the first page and on subsequent pages to show the rest ? You're going to have to manage paging yourself, and modify the SQL to the datasource to return the page you want.

          Christian Graus Driven to the arms of OSX by Vista.

          T 1 Reply Last reply
          0
          • C Christian Graus

            you don't want full alphabetisation, just to show the As on the first page and on subsequent pages to show the rest ? You're going to have to manage paging yourself, and modify the SQL to the datasource to return the page you want.

            Christian Graus Driven to the arms of OSX by Vista.

            T Offline
            T Offline
            Terick
            wrote on last edited by
            #5

            Perhaps I wasn't clear enough. Page 1- Select from All available items, but default screen shows only items starting with letter A. The user can select or search for other items by clicking on a letter of the alphabet. Page 2 - shows All of the selected items from page 1. I need help with Page 1 and only showing the items that start with letter A.

            C 1 Reply Last reply
            0
            • T Terick

              Perhaps I wasn't clear enough. Page 1- Select from All available items, but default screen shows only items starting with letter A. The user can select or search for other items by clicking on a letter of the alphabet. Page 2 - shows All of the selected items from page 1. I need help with Page 1 and only showing the items that start with letter A.

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              Page 2 is obviously unrelated to the current task. Page 1, shows only items starting with A, by default. At some point, in a way you're not defining, it goes on to show all items. Right ? Refer to my first reply. The *best* way to only show items starting with a, is not to filter them somehow in your presentation layer, it's to only request those items from your data store. So, if you only want to show A or show all, you need two different requests for data, one which returns the 'a' items and one which returns all. You'd swap between them based on whatever state change it is that causes you to want to view all. I'd have assumed you'd be paging by letter, which would mean you'd write your own paging code ( and control, I would think ) and from there request each letter as required, but this is even easier.

              Christian Graus Driven to the arms of OSX by Vista.

              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