I have been using ASP.NET for years, but I can never remember when using the # and = are appropriate.
For example:
<%= Grid.ClientID %>
or
<%# Eval("FullName")%>
Can someone explain when each should be used so I can keep it straight in my mind? Is # only used in controls that support databinding?
There are a couple of different 'bee-stings':
<%@
- page directive<%$
- resource access<%=
- explicit output to page<%#
- data binding<%--
- server side comment blockAlso new in ASP.Net 4:
<%:
- writes out to the page, but with HTML encodedAlso new in ASP.Net 4.5:
<%#:
- HTML encoded data bindingIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With