I have an ASP.NET web form composite control, let's call it control A, which contains a child composite control, which I'll call control B. The child controls of control B are dependent on a property of control A.
On initial load I am setting this parameter in OnLoad of control A and everything works fine with the control B setting up its child controls correctly in CreateChildControls.
However, when I want to change this parameter via SelectedIndexChanged on a dropdown in control A the event handler seems to be handled too late in the lifecycle for control B to pick up the changed value. Presumably this is because the CreateChildControls method of control B has already been called.
How can I get control B to update its child controls in such a way that they can then go through their normal lifecycle, loading viewstate as necessary?
Just for clarity, when the parameter of control A is changed the child controls of control B may have to have some that remain, some that need to be removed and some that need to be added, hence for the ones that remain they still need to load state.