where we use <%@ %> <%= %> <%# %> etc.
what else asp tags can be added in asp.net web pages?
2 Answers
<%%> 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 forResponse.Write<%:%>is short forResponse.Write, adding html encoding (introduced with .NET 4.0)<%#%>is a binding expression
This page is a good reference to all these.
Comments
<%@ %> - page directives, Register control
<%= %> - for the server code
<%# %> - for the eval kind of function its also for the server code
3 Comments
ppp
then why this not giving any output Text='<%= DateTime.Now.ToShortTimeString() %>'
Pranay Rana
@ppp it to assign value to control form inline coding
ppp
@Rana means?? how to set lable value to current date time using this tag?