Why in UserControls the tags aren't working
This problem catches me everytime - I create a user control
<foot:footer id="Foot1" runat="server" />
and I add a new property called prop which I want to assign a value using server tags
<foot:footer id="Foot1" runat="server" prop="<%= GetTheProperty() %>" />
which just doesn't work.
The reason that it isn't working is that its a server based control and is entirely setup serverside, so to get it working you
need to add an additional DataBind in the page_load sub and to user the late binding version of the server tags (<%#)
i.e.
<foot:footer id="Foot1" runat="server" prop="<%# GetTheProperty() %>" />
Page.Form.FindControl("Foot1").DataBind()
would do it for the above example
<foot:footer id="Foot1" runat="server" />
and I add a new property called prop which I want to assign a value using server tags
<foot:footer id="Foot1" runat="server" prop="<%= GetTheProperty() %>" />
which just doesn't work.
The reason that it isn't working is that its a server based control and is entirely setup serverside, so to get it working you
need to add an additional DataBind in the page_load sub and to user the late binding version of the server tags (<%#)
i.e.
<foot:footer id="Foot1" runat="server" prop="<%# GetTheProperty() %>" />
Page.Form.FindControl("Foot1").DataBind()
would do it for the above example
| < Prev | Next > |
|---|
