ASP.net 2.0 Create content page

Source: Internet
Author: User
Tags bind

After you create a full master page, you are bound to create a content page. From a user's point of view, the content page has the same access path as the final result page, which seems to indicate that the two are the same file, not actually. The resulting page is a virtual page with no actual code, and its code content is the result of merging master pages and content pages at run time. Before you begin to introduce content pages, there are two other concepts that need to be emphasized: first, that all content in a content page must be included in the contents control, and that the content page must bind to the master page. Although the extension of a content page is the same as a regular ASP.net page, its code structure is very different. In creating a content page, you must always keep in mind the above two important concepts.

As with creating a master page, the process of creating a content page is relatively straightforward. You can open the window shown in Figure 1 by clicking Add New Item ... on the Web Site command menu, or by right-clicking the project in Solution Manager and choosing Add New Item ... in the Drop-down menu.

As shown in Figure 1, you are asked to select a new file type. Because the content page is the same as the extension of the normal. aspx page, the Web Forms icon is selected. Next, you need to set the filename index.aspx. After the settings are complete, you cannot click the Add button directly. Because a content page must bind to a master page, you also need to set the check box "put code in separate files" and "Select Master Page". The former has been described in the previous article, highlighting the latter. The Select master Page check box is used to set whether the Web form you are creating binds to the master page. If you are creating a content page, you must select this option. After you've finished, you can click the OK button to eject the window shown in Figure 1.

The left side of the window is the project folder, and the right side is the list of master pages in the folder. Figure 1 shows a window in which you have just created the master page masterpage.master, select the file, and click OK. With the above steps, you can successfully create a content page that binds the master page masterpage.master index.aspx.

Figure 1 Adding a content page

Figure 2 Selecting a master page

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.