Bind web user control property in markup

Posted by Ian Levy on Stack Overflow See other posts from Stack Overflow or by Ian Levy
Published on 2012-10-03T21:35:39Z Indexed on 2012/10/03 21:37 UTC
Read the original article Hit count: 169

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about vb.net