I’m sure it’s elementary but I can’t figure it out.
This does not work – the the binding expression is passed as string to the control:
<uc:usercontrol runtat="server" message='<%#Me.protectedVariable%>'/>
The code behind include a Page.Databind() call in page_load.
But this does work:
<uc:usercontrol runat="server" id="usercontrol1"/>
And in code behind page_load:
usercontrol1.message = Me.protectedVariable
Do I have to bind from the code-behind? Is this a page life cycle issue?
Moved the Page.DataBind() to the PreRender event handler an the problem was solved. Seems that properties of the web user controls are not yet bound at page_load.