C # development and learning-inline expressions,
<% @ Indicates: Reference<% # Indicates binding<% = Indicates: Value
<% = Variable name %> Response. write () the final result of the output is the same as that of the <% = %> output <% # field name to be bound %> or <% # Call the background method %> <% inline code %> called Inline code... <% = inline expression %> is called an inline expression... <% # data-binding expression %> is called a data binding expression...
- <%... %> <% Response. Write (I) %>
- <% =... %> <% = DateTime. Now. ToString () %> contains only Response. Write (...) Statement embedded code block equivalent
- <% @... %>
| @ Page |
Defines page-specific attributes used by ASP. NET page analyzer and compiler. It can be included only in the. aspx file.
* You can use the command name only on the ASP. NET Web forms page. |
| @ Control |
Defines control-specific attributes used by ASP. NET page analyzer and compiler. It can only be contained in the. ascx file (user control.
* The command name, which can only be in the user control file. |
| @ Import |
Explicitly import a namespace to a page or user control. |
| @ Implementation |
Declares a page or user control to implement the specified. net Framework interface. |
| @ Registration |
Associate the alias with the namespace and class name. This allows user controls and custom server controls to be included in the requested page or user control during rendering. |
| @ Assembly |
Link the assembly to the current page during compilation. It makes all the classes and interfaces of the Assembly available on the page. |
| @ Master |
Identifies the ASP. NET master page. |
| @ WebHandler |
Identifies an ASP. NET IHttpHandler page. |
| @ PreviousPageType |
A method is provided to obtain the strong type of the previous page, for example, access through the PreviousPage attribute. |
| @ MasterType |
Assign a class name to the ASP. NET page of the main attribute. Provides a method to create a strong reference for ASP. NET master pages. |
| @ OutputCache |
Control the page of the output cache policy or user control in declarative mode. |
| @ Reference |
Link to the current page or user control in a declarative manner. |
- <% #... %> Data binding expression
When the DataBind method of the control of this server control is called on the page, the data binding expression creates the binding between the server control property and the data source. <Asp: Label ID = "lblHello" runat = "server" Text = "<% # SayHello %>"> </asp: Label>
- <% $... %> Expression Generator
To set the value of the control property based on the application configuration or the information contained in the resource file, use expression builder <% $ expression Prefix: expression %> value dollar sign ($) indicates ASP. NET is the expression generator. The expression prefix defines the type of expressions such as deleettings, ConnectionStrings, or resources. In addition, you can create and define your own expression generator. The expression value (:) following the colon is the value of some attributes that ASP. NET will actually use.