C # script written in ASP. NET ASPX page; ASP (<%@%>);

Source: Internet
Author: User
Tags tagname

1

<H2>Welcome</H2>    <ul>       <%  for (intI= 0; I<=Convert.ToInt32 (viewdata["Numtime"]); I++) {%>            <Li><%=viewdata["Message"]. ToString ()%></Li>       <% } %>     </ul>

"{" is part of the language and must be written in <%%>

B. asp (<%@%>)

Master,page,control,impot,assembly,reference, etc.

<% @Master%>

Applicable files: Master (Master page)

Example: <%master language= "C #" autoeventwireup= "true" codefile= "BalloonShop.master.cs" inherits= "Balloonshop"%>

Property name

Role

AutoEventWireup

Whether to automatically bind events (Page_Load, etc.)

CodeFile

Specify the code file for the page

<% @Page%>

Applicable files: aspx (aspx page)

Example: <% page title= "" Language= "C #" masterpagefile= "~/balloonshop.master" autoeventwireup= "true" codefile= " Default.aspx.cs "inherits=" _default "%>

Property name

Role

AutoEventWireup

Whether to automatically bind events (Page_Load, etc.)

CodeFile

Specify the code file for the page

Language

The language used by the ASPX page (C # or VB)

MasterPageFile

The master page of the ASPX page

Title

The title of the ASPX page

Page title= "Hello World" language= "C #" masterpagefile= "~/balloonshop.master" autoeventwireup= "true" codefile= " Default.aspx.cs "inherits=" _default "

<% @Control%>

Applicable files: Ascx (user control)

Example:

Control language= "C #" autoeventwireup= "true" codefile= "DepartmentList.ascx.cs" inherits= "Usercontrols_ Departmentlist "

Property name

Role

AutoEventWireup

Whether to automatically bind events (Page_Load, etc.)

CodeFile

Specify the code file for the page

Language

Language used by Ascx (C # or VB)

<% @Register%>

Applicable documents: Master,aspx,ascx

Role: Used to register the ascx control

Example:

<%@ Register src= "~/usercontrols/departmentlist.ascx" tagname= "departmentlist" TagPrefix = "Myascx"%>

<div class= "Left" >

<myascx:departmentlist id= "departmentlist" runat= "Server"/>

......

Property name

Role

Src

The URI of the ascx to be introduced

TagName

Label name of the control

TagPrefix

The prefix name of the control

<% @Import%>

Role: Import namespaces

Applicable documents: Aspx,ascx,master

Example:

<% @Import namespace= "BALLOONSHOPBLL"%>

Property name

Role

Namespace

The namespace to import

<% @Assembly%>

Applicable documents: Aspx,ascx,master,asax

Role: Link an assembly to an ASP. NET application page, such as a Web page, user control, master page, or Global.asax file, so that all of the Assembly's classes and interfaces are available on the page. (similar to import)

Property name

Role

Src

The path to the source file to be dynamically compiled and linked, with the Name selected for use.

Name

The name of the assembly to link to, used with SRC selection.

<% @OutputCache%>

Applicable documents: Ascx,aspx

Role: Set the caching policy in the ASPX page or in the Ascx

Property name

Role

Duration

The time in seconds that the page or user control is cached

Shared

Sets whether the user control output can be shared by multiple Web page files, and if true, multiple Web Forms pages can access the cached user control output, with the optional value: True, False (default), which is used for user control files (. ascx files).

<% @Reference%>

Applicable documents: Mater,aspx,ascx

Function: Used to link another file (aspx,ascx, etc.), after linking can be loaded with Page.LoadControl method.

Property name

Role

Page

The path to the linked Web page file (. aspx file).

Control

The path to the linked user control file (. ascx file).

VirtualPath

The virtual path of the reference.

<% @PreviousPageType%>

Role: Instruction for cross-page delivery

Property name

Role

TypeName

Convert the previous page to TypeName, and use it with the virtualpath option.

VirtualPath

Specifies that the PreviousPage property is a type of virtualpath Web page and is used with TypeName selection.

<% @MasterType%>

Role: Creates a strongly typed reference to a master page when it accesses it through the Master property.

Property name

Role

TypeName

Convert the master to TypeName, and use with the virtualpath option.

VirtualPath

Specifies that the Master property is a type of VirtualPath master, and is used with the TypeName selection.

<% @Implements%>

Applicable documents: Ascx,aspx,master

Role: What to implement in the current page. NET interface

Property name

Role

Interface

Interfaces to implement in a page or user control

Write C # scripts in the

ASP. NET ASPX page; ASP (<%@%>);

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.