I have the following scenario,
2 custom web control with following details;
- Control1 has 2 buttons, button1, button2
- Control2 has 3 drop down boxes
Control1 is added to page by registering the control statically using
<%@ Register Assembly="control1" Namespace="control1"
Control1 is available when the page is loaded, when button1 in control1 is clicked, I am dynamically generating the control2 and adding it in a static collection inside OnInit
Event. Static collection is required to preserve the controls on postback. The static collection is then loaded into PlaceHolder control.
When button2 on the control is clicked, I am dynamically generating control1 and adding it to the placeholder as mentioned above.
The drop down values in the custom control added statically on the page by registering the controls preserves the data on post back. The dynamically added controls do not preserve the data on postback.
Any pointers, samples in this regard will be helpful.
View Complete Post