Expressions as properties for unbound controls

  • Thread starter Thread starter David W
  • Start date Start date
D

David W

Is there a way to set a property to an expression of an unbound control
without doing it in code-behind. For example, if I had a label control, and
wanted to set the Text= property to a Session var - something like:

<asp:Label ID="lblTest" runat="server" Text="<%= Session("name")
%>"></asp:Label>

This of course doesn't work. I know it can be done easily in code-behind,
but is there a way to do it in the markup?

Thanks.
 
<%= %> expressions are not allowed in serverside controls (runat=server). if
the control is the hicd of a control that supports binding (formedit,
repeater ...) then you can us a binding expression (<%=%>).

-- bruce (sqlwork.com)
 
Back
Top