What is the difference between <%%> and <% =%>?

I tried to find the difference on Google.

BUT

I can’t search using << <% %>' , maybe the reason <% is HTML TAG

Now I think that there is no difference between <% and <%= .

+4
source share
5 answers

<% %> executes code between two brackets.

<%= %> returns the value between two brackets.

Example:

 <% Response.Write("Hello.") %> 

against

 <%= "Hello" %> 
+3
source

<% %> and <%= %> are usually server-side scripts, the difference in the first case does not display the value on the page unless you explicitly use the print function, and the second will automatically

+1
source

Are you talking about ASP? If so, then <%%> should hold the code on the server side, and this & lt;% =%> is equivalent to Response.Write ().

0
source

They are usually called beasts. These specific are used by ASP.Net or ASP Classic. <% %> stands for server-side code, and <%=<Something%> <% %> stands for <% Response.Write(<Something>) %>

0
source

If you want to display the current date on the page, you can do one of the following to write the date to the document. In the first example using <% %> you need to explicitly use Response.Write .

 <% Response.Write(DateTime.Now.ToString()) %> 

and in the following there is no need to explicitly write Response.Write

 <%= DateTime.Now.ToString() %> 
0
source

Source: https://habr.com/ru/post/1303893/


All Articles