A
Axel Dahmen
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
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