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. One DataTable two DataGrids???

One DataTable two DataGrids???

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

    Can I use one DataTable and bind it to two DataGrids, each on a separate page? If not, what other options have I got? Ironsmith

    A 1 Reply Last reply
    0
    • I Ironsmith1977

      Can I use one DataTable and bind it to two DataGrids, each on a separate page? If not, what other options have I got? Ironsmith

      A Offline
      A Offline
      Andy Brummer
      wrote on last edited by
      #2

      You can store the data table in session or viewstate, but neither of them are particularly good options if performance is important or you are running on a server farm. If it is static data then you can store the DataTable in the cache or cache the data grid output.


      I can imagine the sinking feeling one would have after ordering my book, only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon

      I 1 Reply Last reply
      0
      • A Andy Brummer

        You can store the data table in session or viewstate, but neither of them are particularly good options if performance is important or you are running on a server farm. If it is static data then you can store the DataTable in the cache or cache the data grid output.


        I can imagine the sinking feeling one would have after ordering my book, only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon

        I Offline
        I Offline
        Ironsmith1977
        wrote on last edited by
        #3

        Hello, Yes I have the DataTable stored in session state, and no, performance isn't an issue on this one. I can bind the DataTable to one DataGrid no problem, but when I tried to bind it to the other one on a different form, it wouldn't work. I didn't recieve an error, there was just no DataGrid on the form. I did reuse the same code to bind this DataGrid as I did the first DataGrid though. Take care Ironsmith

        M 1 Reply Last reply
        0
        • I Ironsmith1977

          Hello, Yes I have the DataTable stored in session state, and no, performance isn't an issue on this one. I can bind the DataTable to one DataGrid no problem, but when I tried to bind it to the other one on a different form, it wouldn't work. I didn't recieve an error, there was just no DataGrid on the form. I did reuse the same code to bind this DataGrid as I did the first DataGrid though. Take care Ironsmith

          M Offline
          M Offline
          minhpc_bk
          wrote on last edited by
          #4

          Hi again, :laugh: How do you go from the first page where you save the data table in Session to another page consuming this datatable? If you simply open a new browser then go to the second page then a new Session will be initialized, and of course there is no table in there, you therefore will not see any grid on the form though you reuse the same code.

          I 1 Reply Last reply
          0
          • M minhpc_bk

            Hi again, :laugh: How do you go from the first page where you save the data table in Session to another page consuming this datatable? If you simply open a new browser then go to the second page then a new Session will be initialized, and of course there is no table in there, you therefore will not see any grid on the form though you reuse the same code.

            I Offline
            I Offline
            Ironsmith1977
            wrote on last edited by
            #5

            Hello, No I'm still in the same app. I got a shopping cart page, then a order details page, so all I do is hit a button to get to the next page. So anything in session state should still carry over to the next page right? Its like a cookie with user info, I can transfer that info to any other page in the app. So it should be the same with a DataTable in session state. Therefore, I used the same code to populate this new table as I did the other one. Take care Ironsmith

            M 1 Reply Last reply
            0
            • I Ironsmith1977

              Hello, No I'm still in the same app. I got a shopping cart page, then a order details page, so all I do is hit a button to get to the next page. So anything in session state should still carry over to the next page right? Its like a cookie with user info, I can transfer that info to any other page in the app. So it should be the same with a DataTable in session state. Therefore, I used the same code to populate this new table as I did the other one. Take care Ironsmith

              M Offline
              M Offline
              minhpc_bk
              wrote on last edited by
              #6

              Yes, you're right, the session state variables should be there. Have you tried to run the app in debug mode and see whether the data table is still in Session? The reasons can be that the datasource is null, or the columns are not specified, then at run time you see nothing at the client side.

              I 1 Reply Last reply
              0
              • M minhpc_bk

                Yes, you're right, the session state variables should be there. Have you tried to run the app in debug mode and see whether the data table is still in Session? The reasons can be that the datasource is null, or the columns are not specified, then at run time you see nothing at the client side.

                I Offline
                I Offline
                Ironsmith1977
                wrote on last edited by
                #7

                Yes this one works now, strange thing too. It wasn't appearing on the form at run time, but the DataTable was there in session state. So I dropped the DataGrid and dragged a new one onto the form, and now it works fine. lol. Take care Ironsmith

                M 1 Reply Last reply
                0
                • I Ironsmith1977

                  Yes this one works now, strange thing too. It wasn't appearing on the form at run time, but the DataTable was there in session state. So I dropped the DataGrid and dragged a new one onto the form, and now it works fine. lol. Take care Ironsmith

                  M Offline
                  M Offline
                  minhpc_bk
                  wrote on last edited by
                  #8

                  Well-done, :-D

                  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