state management in a custom control

Last post 06-26-2009 6:57 PM by Ambran. 1 replies.

Sort Posts:

  • state management in a custom control

    06-26-2009, 3:58 PM
    • Member
      point Member
    • dsteveso
    • Member since 11-09-2007, 3:52 PM
    • Posts 1

    Hello,

    I am currently modifying a custom control I created awhile ago.  When looking at some other examples of viewstate I wondered if I did it correctly.  I overrode the SaveViewState and LoadViewState methods.  It looks like I could have just used ViewState["key"] to store everything.  Are there any benefits / disadvantages to using LoadViewState / SaveViewState over ViewState["key"]?

    Filed under:
  • Re: state management in a custom control

    06-26-2009, 6:57 PM
    Answer
    • Participant
      1,195 point Participant
    • Ambran
    • Member since 03-18-2009, 10:23 AM
    • Denmark
    • Posts 233

    Hi

    I use ViewState["key"] regularly in order to save some data localy until page returns.

    I usualy create a constant for every key so I get better control of the keys that are sometimes spread throughout the page.

    I try not to overload ViewStates with data in order for the page not to be too heavy.

    ViewState["key"] works fine for me. Never manipulated with the SaveViewState and LoadViewState.

    Amit

    If this helped you in any way, mark it as an Answer, Thanks.
Page 1 of 1 (2 items)