ASP. NET website template implementation (section 2nd), asp.net section 2nd
Our main learning task is to master the use of site map files and site navigation controls, as well as the methods for creating master pages and generating content pages.
Learning content:
Step 1: navigation of the website's breadcrumb
1. Create an ASP. NET application, run Visual Studio2008, and select "file"> "new"> "project" in the menu bar for operations.
2. on the "solution Resource Manager" Panel, right-click "solution '123'" and choose "add"> "New Website" from the shortcut menu, create an E: \ 0931 \ Navigation site.
3. Create a site map file (web. sitemap ). On the Solution Explorer panel, right-click the site name Navigation and select the Add new project command from the shortcut menu. In the displayed "Add new project" dialog box, select the "Site Map" template and click "add. Some code of Web. sitemap is as follows:
<SiteMapNode title = "computer software technology 0931" description = "" url = ""> <siteMapNode title = "Homepage" description = "" url = "Default. aspx "> <siteMapNode title =" User Logon "description =" "url = "~ /Login ">
4. Create a bread navigation for Default. aspx on the homepage of the 0931 website. On the Solution Explorer panel of Visual Studio 2008, right-click the site name Navigation and select the Add new project command from the shortcut menu. In the "Add new project" dialog box that appears, select "Web form option" with the name Default. aspx. By Default, the code is stored in a separate file and click "add.
Switch to the design view and drag the SiteMapPath control from the left-side toolkit navigation group.
The code for the Default. aspx page is as follows:
<div class="head_layer"> </div><div class="sitemappath_layer"> </div><div class="foot_layer"> </div>
Run Default. aspx to see the running effect.
5. Create the 0931 user Login page/Login. aspx in the same step, and add the breadcrumb navigation to it.
6. set the format for the breadcrumb navigation, switch to the "design" view, right-click the SiteMapPath control, and select the "auto apply format" command from the shortcut menu to edit it.
Step 2: Add a hot zone
Question 1: How to calculate a hot zone?
Note: What is the difference between image and imagemap?
The Image control is used to add page banner images.
The ImageMap control is used to add a navigation bar image and set a heat area in the navigation bar image (used to provide hyperlinks)
Step 3: Create a master page
Create a master page. On the Solution Explorer panel of Visual Studio 2008, right-click the site name Navigation and select the Add new project command from the shortcut menu. In the displayed "Add new project" dialog box, select the master page with the extension of master. Name it "banji. master" and click "add.
Step 4: Create a content page
Method 1:
(1) create a common Web form page. Right-click the banji folder and select the "Add new project" command from the shortcut menu to create a page file.
(2) transform the creation page into a content page
(3) Run
Method 2:
(1) Add the content page directly to the master page.
(2) On the "solution Resource Manager" Panel, right-click the site name and select the "Add new project" command in the pop-up shortcut menu, select the "select master page" check box when you add a "Web form" to generate An aspx page. In the pop-up dialog box that appears, select the desired master page.
Run:
Summary
Through the study in this section, you can get started with dynamic websites. During the learning process, you can use SiteMapPath to design the breadcrumb navigation. When you are learning and debugging for the first time, you cannot connect to it, check the cause code for spelling errors, and perform hot zone learning, when you set the value, you should set the exact value. If you can, use Dreamweaver. Next, set the master page. The entire learning process requires a large amount of knowledge. You need to learn this knowledge in a short time, there are some difficulties, so we usually need to strengthen the exercises to make them perfect.
We hope that the implementation of this course's website template and bread navigation will be helpful for your future study.