Expressions as properties for unbound controls

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.
 
B

bruce barker \(sqlwork.com\)

<%= %> 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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,140
Latest member
SweetcalmCBDreview
Top