sharing data between custom controls

Discussion in 'ASP .Net Web Controls' started by axis, Sep 23, 2004.

  1. axis

    axis Guest

    I have two custom controls on a page that work on the same object that needs
    some prepping when first loaded. Currently I just load them in both controls
    individually, essentially doing the same work twice.

    What's the best way to share data between controls? I know I could place the
    data in HttpContext, but would I essentially be tripling the amount of
    memory I'm using? 1 copy in control1, 1 copy in context, and 1 copy in
    control2. Unless context works by reference. Otherwise, is there a better
    way? The controls inherit from a common class already -- is there any way to
    have a variable in that parent class that is shared within a page (not
    statically
    across all instances)?

    Thanks
     
    axis, Sep 23, 2004
    #1
    1. Advertising

  2. axis

    Josh Guest

    Stuff your variables into the ViewState
     
    Josh, Sep 23, 2004
    #2
    1. Advertising

  3. axis

    axis Guest

    Won't this mean the object will be serialzed and put on the html as a hidden
    form object? (sorry if I'm mistaking view state for something else) It's a
    big object, not an int or bool. Also, what implication does this have on
    data duplcation?

    "Josh" <> wrote in message
    news:...
    > Stuff your variables into the ViewState
    >
    >
     
    axis, Sep 23, 2004
    #3
  4. axis

    axis Guest

    BTW -- there's no need to persist the data after the page is rendered. Sorry
    I didn't clarify this. It's just data used while rendering the controls. The
    data is needed by various controls.

    "Josh" <> wrote in message
    news:...
    > Stuff your variables into the ViewState
    >
    >
     
    axis, Sep 23, 2004
    #4
  5. I would suggest you to check inter webpart communication with sharepoint
    services. Actually webparts are nothing lese but web custom controls. I know
    comunicating with eachother is possible, but havent checked it out yet.
    Check documentation...

    --
    RobertK
    { Clever? No just smart. }

    "Josh" <> wrote in message
    news:...
    > Stuff your variables into the ViewState
    >
    >
     
    Robert Koritnik, Sep 23, 2004
    #5
    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. Jason
    Replies:
    1
    Views:
    724
  2. axis
    Replies:
    2
    Views:
    522
    Jonathan Allen
    Sep 25, 2004
  3. Michael
    Replies:
    3
    Views:
    369
    Curt_C [MVP]
    Feb 3, 2005
  4. rodchar
    Replies:
    0
    Views:
    400
    rodchar
    Nov 26, 2007
  5. Replies:
    3
    Views:
    376
    Angel
    Feb 6, 2008
Loading...

Share This Page