Control Not remembering property on postback

Discussion in 'ASP .Net Building Controls' started by Teemu Keiski, Jul 13, 2005.

  1. Teemu Keiski

    Teemu Keiski Guest

    Hi,

    where in the lifecycle / events you reading/writing the value? Init, Load,
    postback event, PreRender...?

    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU
    http://blogs.aspadvice.com/joteke
     
    Teemu Keiski, Jul 13, 2005
    #1
    1. Advertising

  2. I am having problems getting my customer control to remember properties
    accross postback. I have tried setting it to a session. What is the
    recommended way of doing this.

    I have tried this
    'set it to session
    _location = Value.ToString()
    System.Web.HttpContext.Current.Session("XmlPath") = _location

    'on the postback where I have the problem if the location is empty read in
    the session

    if _location = "" then
    _location = System.Web.HttpContext.Current.Session("XmlPath")
    end if
     
    Chris Kennedy, Jul 13, 2005
    #2
    1. Advertising

  3. Teemu Keiski

    Teemu Keiski Guest

    If I understand correctly what you mean (just in member declarations), then
    yes, it could be the reason. Try setting it in some event like Load (it just
    should be set before accessed).

    Are you still reading it normally in some event?.

    --
    Teemu Keiski
    ASP.NET MVP, AspInsider
    Finland, EU
    http://blogs.aspadvice.com/joteke
     
    Teemu Keiski, Jul 13, 2005
    #3
  4. I am just setting the property in the public declarations like with any
    object. This is in any event. Is this where I am going wrong?


    "Teemu Keiski" <> wrote in message
    news:...
    > Hi,
    >
    > where in the lifecycle / events you reading/writing the value? Init, Load,
    > postback event, PreRender...?
    >
    > --
    > Teemu Keiski
    > ASP.NET MVP, AspInsider
    > Finland, EU
    > http://blogs.aspadvice.com/joteke
    >
    >
     
    Chris Kennedy, Jul 14, 2005
    #4
  5. The property is set in the Load event of the parent page. It's just on
    postback the control doesn't remember the property?

    The control has some control and a button control. I have added an event to
    the button click. When I try to access the property in the onCLick event it
    can't find the property.


    "Teemu Keiski" <> wrote in message
    news:ODvON8#...
    > If I understand correctly what you mean (just in member declarations),

    then
    > yes, it could be the reason. Try setting it in some event like Load (it

    just
    > should be set before accessed).
    >
    > Are you still reading it normally in some event?.
    >
    > --
    > Teemu Keiski
    > ASP.NET MVP, AspInsider
    > Finland, EU
    > http://blogs.aspadvice.com/joteke
    >
    >
     
    Chris Kennedy, Jul 15, 2005
    #5
  6. Teemu Keiski

    Teemu Keiski Guest

    Teemu Keiski, Jul 18, 2005
    #6
    1. Advertising

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. Replies:
    3
    Views:
    784
    Justin Lovell
    Oct 5, 2003
  2. Prince

    Remembering Events

    Prince, Feb 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    750
    Prince
    Feb 17, 2004
  3. Piotrek \Alchemik\
    Replies:
    0
    Views:
    310
    Piotrek \Alchemik\
    Nov 12, 2006
  4. Louisa99
    Replies:
    4
    Views:
    7,763
  5. webmasterATflymagnetic.com

    Global variable not remembering value

    webmasterATflymagnetic.com, Jan 21, 2008, in forum: Javascript
    Replies:
    9
    Views:
    141
    Doug Gunnoe
    Jan 22, 2008
Loading...

Share This Page