Share Information Among a Page and its UserControls?

Discussion in 'ASP .Net Web Controls' started by Axel Dahmen, Dec 6, 2003.

  1. Axel Dahmen

    Axel Dahmen Guest

    I need to share complex data across a page and its Web user controls. Can
    someone please enlighten me on how to do this?


    My approach doesn't work:

    * Create a class,

    * add a public reference to that class to the ASPX page and all the Web user
    controls (WUCs),

    * in the Page's Init() event, create an object of the class, set all its
    members and set all the WUCs' references to this object,

    * access the object from any of the references.


    This and similar approaches (e.g. using only one public reference in the
    Page and access it from the WUCs) don't work because the WUCs' Init() event
    are called before the Page's Init() event, so I can neither create an object
    nor initialize any reference at this central point.

    The data to be shared across the WUCs comes from the database, hence it's
    quite expensive to create a distinct object from within each of the WUCs. I
    can't also use the Load() events because I use the class's data to
    dynamically create controls in the WUCs.

    Any ideas?

    TIA,
    Axel Dahmen
     
    Axel Dahmen, Dec 6, 2003
    #1
    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. Guadala Harry

    Share SQL DB Among Dozens of Sites

    Guadala Harry, Feb 21, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    332
    Peter Bromberg [C# MVP]
    Feb 21, 2004
  2. MK
    Replies:
    6
    Views:
    717
    noSpAm0000
    May 16, 2005
  3. red floyd
    Replies:
    1
    Views:
    502
    Zhang Yan
    Sep 6, 2003
  4. Axel Dahmen

    Share Information Between a Page and its UserControls?

    Axel Dahmen, Oct 24, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    137
    Axel Dahmen
    Oct 24, 2003
  5. Saraswati lakki
    Replies:
    0
    Views:
    1,416
    Saraswati lakki
    Jan 6, 2012
Loading...

Share This Page