[ACCEPTED]-In ASP.Net, what is the difference between <%= and <%#-asp.net
Accepted answer
See this question:
When should I use # and = in ASP.NET controls?
Summary from those answers:
There 1 are a several different 'bee-stings':
<%@
- Page/Control/Import/Register directive<%$
- Resource access and Expression building<%=
- Explicit output to page, equivalent to<% Response.Write( ) %>
<%#
- Data Binding. It can only used where databinding is supported, or at the page level if you callPage.DataBind()
in your code-behind.<%--
- Server-side comment block<%:
- Equivalent to<%=
, but it also html-encodes the output.
<%#
is data binding expression syntax.
<%=
resolves the expression returns its 2 value to the block (Embedded code block reference) - effectively shorthand 1 for <% Response.Write(...); %>
<%# is the databinding directive, <%= is 1 a shortcut for "Response.Write"
<%= x %> is shorthand for Response.Write()
<%# x 2 %> indicates a databind.
<% %> indicates 1 server-executable code.
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.