Help w/ LoadViewState and SaveViewState subs

Discussion in 'ASP .Net' started by Showjumper, Jun 26, 2003.

  1. Showjumper

    Showjumper Guest

    Hi,
    I have implemented the istatemanager interface in control so that i can
    retrieve values from the viewstate and then update my control. The control
    is an image gallery and i want it to react to postbacks i.e a dropdown list
    of image folder choices - user selects a folder and then my control will
    display from that folder. However, in using the load and saveviewstate, the
    control doesnt work quite right. It takes 2 clicks of the button to load the
    right gallery. And then when you page the gallery reverts back to the
    original one. The problem as far asi can tell has to do w/ the these 2 subs.
    I have tried other variations which dont work at all. I hope someone has
    some ideas. How can i get the the control to behave properly. Here is the
    code:


    Protected Overrides Sub LoadViewState(ByVal savedstate As Object)
    Implements System.Web.UI.IStateManager.LoadViewState
    If Not (savedstate Is Nothing) Then
    _imagedirectory = CType(savedstate, String)
    End If
    End Sub

    Protected Overrides Function SaveViewState() As Object Implements
    System.Web.UI.IStateManager.SaveViewState
    Return _imagedirectory
    End Function
     
    Showjumper, Jun 26, 2003
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bolin

    Subs and lists

    Bolin, Nov 2, 2003, in forum: Perl
    Replies:
    6
    Views:
    719
  2. Kevin Spencer

    Re: Shared (Static) Function and Subs

    Kevin Spencer, Mar 3, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    451
    Carlos Campos
    Mar 3, 2004
  3. David Palfery

    saveviewstate for the entire page

    David Palfery, May 2, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    551
    David Palfery
    May 2, 2004
  4. tshad

    SaveViewState executing twice

    tshad, Aug 25, 2006, in forum: ASP .Net
    Replies:
    7
    Views:
    1,053
    tshad
    Aug 30, 2006
  5. Louis Somers

    SaveViewState called before events are fired

    Louis Somers, Aug 8, 2008, in forum: ASP .Net
    Replies:
    0
    Views:
    723
    Louis Somers
    Aug 8, 2008
  6. Stephen Miller

    Why is SaveViewState called twice in the Control Life Cycle?

    Stephen Miller, Dec 31, 2003, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    749
    Teemu Keiski
    Jan 1, 2004
  7. Teemu Keiski

    How to "track" a (child) control's ViewState / SaveViewState?

    Teemu Keiski, Apr 5, 2005, in forum: ASP .Net Building Controls
    Replies:
    3
    Views:
    427
    Zarko Gajic
    Apr 6, 2005
  8. Colin Mc Mahon

    Functions vs. subs and role reversal

    Colin Mc Mahon, Sep 12, 2003, in forum: ASP General
    Replies:
    4
    Views:
    291
    Chris Barber
    Sep 13, 2003
Loading...