ASP. NET 2.0 @ implements @ register @ Assembly @ previouspagetype @ mastertype command

Source: Internet
Author: User
ArticleDirectory
    • @ Implements
    • @ Register
    • @ Assembly
    • @ Previouspagetype
    • @ Mastertype
@ Implements

The @ implements command allows ASP. NET pages to implement specific. NET Framework interfaces. This command only supports one interface attribute.

The. NET Framework interface is directly specified in the interface attribute. When ASP. NET pages or user controls implement an interface, they can directly access all the events, methods, and properties.

The following is an example of the @ implements command:

<% @ Implements interface = "system. Web. UI. ivalidator" %>

@ Register

The @ register command associates aliases with namespaces and class names as tokens in the Custom Server Control syntax. When you drag a user control to the. ASPX page, the @ register command is used. Drag and Drop the user control to the. ASPX page. Visual Studio 2005 creates a @ register command at the top of the page. In this way, the user control is registered on the page, and the control can be accessed through a specific name on the. ASPX page.

The @ register command supports five attributes, as shown in Table 3-7.

Table 3-7

Genus

Description

Assembly

Program set associated with tagprefix

namespace

namespace associated with tagprefix

SRC

User control location

tagname

alias associated with the class name

Tagprefix

Alias associated with the namespace

The following is an example of using the @ register command to import a user control to the ASP. NET page:

<% @ Register tagprefix = "mytag" namespace = "myname: mynamespace"

Assembly = "myassembly" %>

@ Assembly

@ Assembly command associates the Assembly (. NET application building block) with ASP. NET pages or user controls during compilation so that all classes and interfaces in the Assembly can be used for pages. This command supports two attributes: Name and SRC.

● Name: allows you to specify the Assembly name used to associate page files. The Assembly name should only contain the file name, not the file extension. For example, if the file is myassembly. VB, the name attribute value should be myassembly.

● SRC: allows you to specify the Assembly file source used for compilation.

The following are some examples of using the @ Assembly command:

<% @ Assembly name = "myassembly" %>

<% @ Assembly src = "myassembly. VB" %>

@ Previouspagetype

This command is used to specify the page on which the cross-page transfer process starts. For cross-page transfer between ASP. NET pages, see section 19th "cross-page transfer" and section.

@ Previouspagetype is a new command used to process the cross-page transfer function provided by ASP. NET 2.0. This simple command only contains two attributes: typename and virtualpath:

● Typename: Specifies the name of the derived class during the delivery.

● Virtualpath: Set the address of the page to be sent during delivery.

@ Mastertype

@ Mastertype command associates a class name with an ASP. NET page to obtain strongly typed references or members contained in a specific master page. This command supports two attributes:

● Typename: indicates the name of the derived class from which a strongly typed reference or member is obtained.

● Virtualpath: sets the page addresses from which to retrieve these strongly typed references or members.

For details about how to use the @ mastertype command, see Chapter 8th. The following is an example:

<% @ mastertype virtualpath = "~ /Wrox. Master "%>

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.