In ASP.Net, what is the difference between <%= and <%#

In ASP.Net, what is the difference between <%= x %> and <%# x %>?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

See this question:
When should I use # and = in ASP.NET controls?


Summary from those answers:

There are a several different ‘bee-stings’:

Method 2

<%# is data binding expression syntax.

<%= resolves the expression returns its value to the block (Embedded code block reference) – effectively shorthand for <% Response.Write(...); %>

Method 3

<%# is the databinding directive, <%= is a shortcut for “Response.Write”

Method 4

<%= x %> is shorthand for Response.Write()

<%# x %> indicates a databind.

<% %> indicates server-executable code.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x