1. Instruction syntax
① @ Page command
It can only be contained in the. aspx file. Syntax:
<% @ Page attribute = "value" [attribute = "value"...] %>
②. @ Control command
It can only be contained in the. ascx file (User Control). Syntax:
<% @ Control attribute = "value" [attribute = "value"...] %>
③. @ Import command
Explicitly import a namespace to an ASP. NET application
Program File (such as web pages, user controls, master pages), all the classes and interfaces of the imported namespace can be used for files.
<% @ Import namespace = "value" %>
④. @ Implements
Indicates that the current ASP. NET application file implements the specified. NET Framework interface.
<% @ Implements interface = "validinterfacename" %>
⑤. @ Register
⑥. @ Assembly
7. @ reference
Response. @ outputcache
2.CodeDeclare Block <ScriptRunat= "Server"Language= "Codelanguage"SRC= "Pathname">
Code
</Script>
Example: Code
< Html >
< Script Language = "C #" Runat = "Server" >
Void Enterbtn_click (Object SRC, eventargs E)
{
Message. Text = " Echo from the wise: Hello! " + Name. Text + " I have forgotten for you. Your life will be wonderful. " + " <Br> " + " And a happy life! But the condition is: you must appreciate yourself, love your life, and make unremitting efforts. " ;
}
</ Script >
< Body >
< Center >
< Form ID = "Form1" Runat = "Server" >
< H4 > Do you want to know what your life is like? </ H4 > < BR />
Enter your name:
< ASP: textbox ID = "Name" Runat = "Server" > </ ASP: textbox >
< ASP: button ID = "Button1" Text = "Submit" Onclick = "Enterbtn_click" Runat = "Server" />
< P >
< ASP: Label ID = "Message" Runat = "Server" > </ ASP: Label >
</ P >
</ Form >
</ Center >
</ Body >
</ Html >
3. Code rendering Block
Inline code and inline expressions (do not understand) Code
< Html >
< Head Runat = "Server" >
< Title > Fast DEMO code presentation </ Title >
</ Head >
< Body >
< Center >
<%
For ( Int I = 4 ; I < 7 ; I ++ )
{
%>
< Font Size = <% = I % > > The significance of life lies in creation, while struggle is a means. </ Font > < BR />
<% } %>
</ Center >
</ Body >
</ Html >