where we use <%@ %>
<%= %>
<%# %>
etc.
what else asp tags can be added in asp.net web pages?
views:
42answers:
2
A:
<%@ %> - page directives, Register control
<%= %> - for the server code
<%# %> - for the eval kind of function its also for the server code
Pranay Rana
2010-09-28 11:43:02
then why this not giving any output Text='<%= DateTime.Now.ToShortTimeString() %>'
ppp
2010-09-28 11:50:11
@ppp it to assign value to control form inline coding
Pranay Rana
2010-09-28 11:52:55
@Rana means?? how to set lable value to current date time using this tag?
ppp
2010-09-28 11:56:30
<asp:Button ID="Button1" runat="server" Text= "<%# MyValue%>" /> try this
Pranay Rana
2010-09-28 12:01:57
+2
A:
<%%>
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.
Oded
2010-09-28 11:45:56