Home All Groups Group Topic Archive Search About

dynamically set property on a control

Author
24 Aug 2006 11:23 AM
Peter Kirk
Hi

say I have a literal on an ascx:
<asp:Literal id="myLabel" runat="server" Text="literal text" />

How do I change the text value to a "dynamic" value?

I would like to be able to do something like:
<asp:Literal id="myLabel" runat="server" Text="<%= myName %>" />

where myName is a string defined elsewhere. The only way I know of doing
this is by setting the text value in the code behind, but is it possible to
do it in the ascx?

thanks,
Peter