G
Gummy
Hello,
I am loading several user controls dynamically in OnInit() like this:
ucListBoxSelections ucLocation =
(ucListBoxSelections)LoadControl("UserControls/ucListBoxSelections.ascx");
ucListBoxSelections ucDept =
(ucListBoxSelections)LoadControl("UserControls/ucListBoxSelections.ascx");
ucListBoxSelections ucBusiness =
(ucListBoxSelections)LoadControl("UserControls/ucListBoxSelections.ascx");
PlaceHolder1.Controls.Add(ucLocation);
PlaceHolder1.Controls.Add(ucDept);
PlaceHolder1.Controls.Add(ucBusiness);
Then, in the Page_Load I thought I should be able to access these Controls
and reload (or assign for the first time) its data through the ViewState
(that has not been lost because it was loaded in OnInit().
Am I doing this correctly because I cannot "find" these Controls in
Page_Load?
Also, each time I click on any one of these User Controls there is a
postback, as expected, but all the listboxes (in each of the user controls)
still seems slow to load. I assume that is because they are reloading. The
idea, I thought, was that it was faster to load these controls in OnInit.
I think I am close, does anyone have some suggestions?
Thank you.
p.s. There are several user controls that get loaded each time. However,
they do not have to be dynamic because they will always appear on the page.
It's just their data in their listboxes will change. Is there a better way
to approach this?
I am loading several user controls dynamically in OnInit() like this:
ucListBoxSelections ucLocation =
(ucListBoxSelections)LoadControl("UserControls/ucListBoxSelections.ascx");
ucListBoxSelections ucDept =
(ucListBoxSelections)LoadControl("UserControls/ucListBoxSelections.ascx");
ucListBoxSelections ucBusiness =
(ucListBoxSelections)LoadControl("UserControls/ucListBoxSelections.ascx");
PlaceHolder1.Controls.Add(ucLocation);
PlaceHolder1.Controls.Add(ucDept);
PlaceHolder1.Controls.Add(ucBusiness);
Then, in the Page_Load I thought I should be able to access these Controls
and reload (or assign for the first time) its data through the ViewState
(that has not been lost because it was loaded in OnInit().
Am I doing this correctly because I cannot "find" these Controls in
Page_Load?
Also, each time I click on any one of these User Controls there is a
postback, as expected, but all the listboxes (in each of the user controls)
still seems slow to load. I assume that is because they are reloading. The
idea, I thought, was that it was faster to load these controls in OnInit.
I think I am close, does anyone have some suggestions?
Thank you.
p.s. There are several user controls that get loaded each time. However,
they do not have to be dynamic because they will always appear on the page.
It's just their data in their listboxes will change. Is there a better way
to approach this?