Hi there

I've run into a very confusing problem (which I'm sure someone has a simple
solution :-)

I've created a web custom control that contains some literal controls, a
button, and two text boxes (a composite control). The control has a number
of properties, which are saved to the view state. Additionally, there's
a method (I've called Update) that changes the properties, and thus the contents
of the text boxes.

Here's the problem;

When I run a web form with this control, the methods run as follows for the
first page load;

1. Page_Load
2. Control.Update (called from Page_Load in Not IsPostback condition)
3. CreateChildControls in the control (taking into account the changes made
by the Update method).

Now things get strange. I've got a textbox and button (not part of the control),
that I enter an ID number and click the button. The idea being that the
ID number causes one of the text boxes in the control to be updated. This
is how it runs;

1. Type ID and click on button.
2. CreateChildControls runs (why early this time??)
3. Page_Load runs
4. Click_Event runs (which calls Update with the new value).

Because CreateChildControls runs earlier than the initial page load, it never
renders the control using the new properties.

This gets stranger. I'm looking at this sequence and thinking how come this
isn't a problem for one of the other controls that I've created that has
a dynamic menu bar made up of hyperlink controls. So I changed the text
boxes to hyperlinks and magically the CreateChildControls method now runs
after the Click_Event. I've tried a number of other web form controls (dropdownlist,
label, linkbutton etc) and they all run the CreateChildControls in the correct
place. As soon as I add a textbox, the CreateChildControls method gets called

Is the text box just different to the rest or am I doing something wrong?

Thanks for your help.