tags:

views:

63

answers:

5

I tried to find the diffrence on the google.

BUT

I 'm not able to search with '<% %>' , maybe the reason is <% is a HTML TAG

Now i'm thinking there's no diffrence betwwen <% and <%= .

+1  A: 

<% %> and <%= %> are normally server side scripts, the difference is first one does not print out the value to the page, unless you explicitly use print function, but second one will do automatically

S.Mark
A: 

Are you talking about the ASP ? If yes then <% %> is to hold the server side code and this is <%= %> equivalent to the Response.Write().

Anil Namde
+3  A: 

<% %> executes the code between the 2 brackets.

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

Example:

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

vs

<%= "Hello" %>
Blindy
A: 

They're generally referred to as beestings. These particular ones are used by ASP.Net or ASP Classic. <% %> signifies server side code and <%=<Something%> is shorthand for <% Response.Write(<Something>) %>

Spencer Ruport
A: 

If you want to show current date in a page you can do either of the following to write the date to the document. In the first sample using <% %> you have to explicitly use Response.Write.

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

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

<%= DateTime.Now.ToString() %>
rahul