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. Persisting the ViewState

Persisting the ViewState

Scheduled Pinned Locked Moved ASP.NET
sysadminhelpquestion
5 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.
  • H Offline
    H Offline
    Hercules01
    wrote on last edited by
    #1

    hi all, i'm developing a Data-Bound Control, I was wondering if i have to save the ViewState of the DataSource, i mean what is the danger if i make the server always provide me with the DataSource between PostBacks by saving it in the Session Object so i don't need to send all the Data as a ViewState to the Client Side in each round trip. Does anyone know any drawbacks for this method, maybe like reserving the Server resources or anything, thanks for your help.

    M 1 Reply Last reply
    0
    • H Hercules01

      hi all, i'm developing a Data-Bound Control, I was wondering if i have to save the ViewState of the DataSource, i mean what is the danger if i make the server always provide me with the DataSource between PostBacks by saving it in the Session Object so i don't need to send all the Data as a ViewState to the Client Side in each round trip. Does anyone know any drawbacks for this method, maybe like reserving the Server resources or anything, thanks for your help.

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

      Hi there, In my opinion, to make your control flexible, you should let that control work in the same way as other web controls do. I mean, the user should be given an option of enabling/disabling the ViewState. If he plans to disable the ViewState, he might need to save the data source in Session or reload from data store to bind to the control in every post to the server. In addition, as you know that we use the session model to store data and objects across multiple web requests. If you plan to save the data source in Session, you might also need to think about what you should do if your control is used in many places in your application and you need to ensure that the SessionID value to save the data source is unique to the control. For more information on this issue, you can take a quick look at these documents. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbconChoosingServerStateOption.asp[^] http://msdn.microsoft.com/library/en-us/cpguide/html/cpconmantainingstateincontrol.asp[^]

      H 1 Reply Last reply
      0
      • M minhpc_bk

        Hi there, In my opinion, to make your control flexible, you should let that control work in the same way as other web controls do. I mean, the user should be given an option of enabling/disabling the ViewState. If he plans to disable the ViewState, he might need to save the data source in Session or reload from data store to bind to the control in every post to the server. In addition, as you know that we use the session model to store data and objects across multiple web requests. If you plan to save the data source in Session, you might also need to think about what you should do if your control is used in many places in your application and you need to ensure that the SessionID value to save the data source is unique to the control. For more information on this issue, you can take a quick look at these documents. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbconChoosingServerStateOption.asp[^] http://msdn.microsoft.com/library/en-us/cpguide/html/cpconmantainingstateincontrol.asp[^]

        H Offline
        H Offline
        Hercules01
        wrote on last edited by
        #3

        thx again man ur giving me a gr8 help.

        M 1 Reply Last reply
        0
        • H Hercules01

          thx again man ur giving me a gr8 help.

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

          Hey, how do you know if I'm a man or .... a pretty girl? ;P

          H 1 Reply Last reply
          0
          • M minhpc_bk

            Hey, how do you know if I'm a man or .... a pretty girl? ;P

            H Offline
            H Offline
            Hercules01
            wrote on last edited by
            #5

            simply pretty girls won't waste their time on writing such a clever replies

            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