ppp
ppp

Reputation: 259

how to Embedded Code Blocks in ASP.NET Web Pages?

where we use <%@ %> <%= %> <%# %> etc. what else asp tags can be added in asp.net web pages?

Upvotes: 9

Views: 4344

Answers (2)

Oded
Oded

Reputation: 499382

<%%> is short hand for:

<script runat="server">
</script>

Anyting inside the <% and %> is server side code.

The other variants are also shortcuts:

  • <%@%> is a page directrive
  • <%=%> is short for Response.Write
  • <%:%> is short for Response.Write, adding html encoding (introduced with .NET 4.0)
  • <%#%> is a binding expression

This page is a good reference to all these.

Upvotes: 15

Pranay Rana
Pranay Rana

Reputation: 176956

<%@ %> - page directives, Register control
<%= %> - for the server code  
<%# %> - for the eval kind of function its also for the server code

Upvotes: 0

Related Questions