Share Information Between a Page and its UserControls?

Discussion in 'ASP .Net Web Controls' started by Axel Dahmen, Oct 24, 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, Oct 24, 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. Axel Dahmen

    Share Information Among a Page and its UserControls?

    Axel Dahmen, Dec 6, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    91
    Axel Dahmen
    Dec 6, 2003
  2. Saraswati lakki
    Replies:
    0
    Views:
    1,356
    Saraswati lakki
    Jan 6, 2012
  3. thunk
    Replies:
    1
    Views:
    323
    thunk
    Mar 30, 2010
  4. thunk
    Replies:
    0
    Views:
    496
    thunk
    Apr 1, 2010
  5. thunk
    Replies:
    14
    Views:
    630
    thunk
    Apr 3, 2010
Loading...

Share This Page