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. Session or Viewstate

Session or Viewstate

Scheduled Pinned Locked Moved ASP.NET
questioncssalgorithms
5 Posts 4 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.
  • N Offline
    N Offline
    Nishant Singh
    wrote on last edited by
    #1

    Hi Everybody, I need to store a datatable in my page (To bind a grid again after Sorting To be precised) At present I am storing it in viewstate My question is will it better to store it in session rather than ViewState(As that Datatable is quite big the page may become quite heavy)???

    A C L 3 Replies Last reply
    0
    • N Nishant Singh

      Hi Everybody, I need to store a datatable in my page (To bind a grid again after Sorting To be precised) At present I am storing it in viewstate My question is will it better to store it in session rather than ViewState(As that Datatable is quite big the page may become quite heavy)???

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      Yes, I will suggest you to store data table in Session , rather than View State as you data size is quite big. Any way you can check one of my article on view state Beginner's Guide to View State[^] And don't forget to read Discussion Section [ViewState Vs Session ]

      cheers, Abhijit

      N 1 Reply Last reply
      0
      • A Abhijit Jana

        Yes, I will suggest you to store data table in Session , rather than View State as you data size is quite big. Any way you can check one of my article on view state Beginner's Guide to View State[^] And don't forget to read Discussion Section [ViewState Vs Session ]

        cheers, Abhijit

        N Offline
        N Offline
        Nishant Singh
        wrote on last edited by
        #3

        hi Abhijit, read the article ... good one thanx

        1 Reply Last reply
        0
        • N Nishant Singh

          Hi Everybody, I need to store a datatable in my page (To bind a grid again after Sorting To be precised) At present I am storing it in viewstate My question is will it better to store it in session rather than ViewState(As that Datatable is quite big the page may become quite heavy)???

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

          Your best bet if it's big is to store the ids needed to build it, on the URL perhaps, and then get the data from the DB as needed. keeping viewstate down is a good thing, but using the session too much is also a bad move.

          Christian Graus Driven to the arms of OSX by Vista.

          1 Reply Last reply
          0
          • N Nishant Singh

            Hi Everybody, I need to store a datatable in my page (To bind a grid again after Sorting To be precised) At present I am storing it in viewstate My question is will it better to store it in session rather than ViewState(As that Datatable is quite big the page may become quite heavy)???

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Hi Nishant Session v/s Viewstate is quite a good question, but you need to consider two things before you make up your mind. 1. How long you want to retain the DataTable in Memory. i.e. if your site is hosted on shared server then you cannot hold it for more than a 5-10 mins as the services restart and the session is destroyed. So in this case the viewstate is better option. But if you are having dedicated server then opt for session. 2. Why not XML. Create a XML of datatable with unique name, write it to disk and then save the file name in ViewState. You will save both the ViewState and session memory.

            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