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. Manually Populating Grids

Manually Populating Grids

Scheduled Pinned Locked Moved ASP.NET
csssysadminalgorithmsperformance
3 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.
  • P Offline
    P Offline
    Pualee
    wrote on last edited by
    #1

    I'm trying to manually populate a GridView on a web form. I know how to populate it using a DataSource control, but I cannot get the desired effects using the automatic features. My scenario: I have a DataTable persisting on server side memory. I want to populate a grid of products once per session, but have the table persist and used by every session. I have worked out an algorithm to do this using manual population, but cannot get the grid populated (used to VB6). Should I find a way to use automatic population with a DataSource, or is there an easy way to populate the grid? Is GridView the wrong control for what I want to do? Thanks in advance, Pualee

    I 1 Reply Last reply
    0
    • P Pualee

      I'm trying to manually populate a GridView on a web form. I know how to populate it using a DataSource control, but I cannot get the desired effects using the automatic features. My scenario: I have a DataTable persisting on server side memory. I want to populate a grid of products once per session, but have the table persist and used by every session. I have worked out an algorithm to do this using manual population, but cannot get the grid populated (used to VB6). Should I find a way to use automatic population with a DataSource, or is there an easy way to populate the grid? Is GridView the wrong control for what I want to do? Thanks in advance, Pualee

      I Offline
      I Offline
      Ista
      wrote on last edited by
      #2

      Store the DataTable inside the Application object on your web form do: MyDataGrid.DataSource = myDataTable.DefaultView; myDataGrid.DataBind(); 1 line of code equals many bugs. So don't write any!!

      P 1 Reply Last reply
      0
      • I Ista

        Store the DataTable inside the Application object on your web form do: MyDataGrid.DataSource = myDataTable.DefaultView; myDataGrid.DataBind(); 1 line of code equals many bugs. So don't write any!!

        P Offline
        P Offline
        Pualee
        wrote on last edited by
        #3

        Many thanks! I actually had a realization that was similar to this. I noticed that I can use a DataTable for the DataSource, rather than another control. With the data table, I can filter and change the table as necessary before updating the GridView :-) Thus, the GridView will display my table as desired. Pualee

        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