Bind web user control property in markup
- by Ian Levy
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?