You might think that the ContentBoxVariation would pass it's Title to the ContentBox, and that the result would be "Welcome to Sam's."

Unfortunately, it does pass it's title, but the title hasn't been changed from its default of "" at the time it happens. As far as I can tell, the instantiation happens in this order:

Instantiate ContentBoxVariation

Instantiate the composed ContentBox

Set ContentBox's Title to the variation's title, which is currently "". Even if setting it to a different variable, it seems to stay blank as if that variable doesn't exist, even though it does and no error occurs.

Set the variation's title.

The order makes sense if you are looking at it like that, but being in templates and looking at it from that point of view, it is surprising.

The solution is to explicitly set the title for ContentBox in code, like this:

<%
ContentBox1.Title = this.Title;
%>

Hopefully that saves someone some time.

Hey! Why don't you make your life easier and subscribe to the full post
or short blurb RSS feed? I'm so confident you'll love my smelly pasta plate
wisdom that I'm offering a no-strings-attached, lifetime money back guarantee!

All of your controls are getting initialized in the Init event. My guess is that since your ContentBoxVariation control depends on your ContentBox control the ContentBox control is being initialized prior to your ContentBoxVariation control. Which is why your Text property isn't being populated (ContentBoxVariation hasn't been initialized yet).

The msdn page says Page Load is where you'd want to set any properties. Your inline code is probably getting executed there, or after (didn't find where inline code gets executed), so that's probably why it fixed the problem. :)

Your email address is not displayed.
It is used only to respond to you if needed, and
send comments if you subscribe to this comment thread.
It is stored in a cookie if you choose to "Remember my details".