Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Build Your Own ASP.NET 2.0 Web Site Using CSharp And VB (2006) [eng]-1.pdf
Скачиваний:
143
Добавлен:
16.08.2013
Размер:
15.69 Mб
Скачать

Extending Dorknozzle

Figure 5.43. Editing a web form that uses a master page

Figure 5.44. Welcome to Dorknozzle!

Extending Dorknozzle

We’ll extend the Dorknozzle site by adding an employee help desk request web form. This form will allow our fictitious employees to report hardware, software,

201

Chapter 5: Building Web Applications

and workstation problems to the help desk. The Web Form will be arranged into a series of simple steps that users will follow to report their problems. The process will include the following stages:

Choose from a predefined list of potential problem areas.

Choose from a range of predetermined subjects that are related to the problem area.

Enter a description of the problem.

Submit the request.

As we already have a master page that defines the layout of the site’s pages, adding a new page to the site is now a trivial task. In this example, we’ll see how simple it is to add new pages to an ASP.NET web site once the structure has been created correctly.

Create a web form in the same way you created Default.aspx, but this time, name it HelpDesk.aspx. Be sure to check both the Place code in separate file and Select master page checkboxes. Next, modify the default code that will be generated as shown below:

File: HelpDesk.aspx (excerpt)

<%@ Page Language="VB" MasterPageFile="~/Dorknozzle.master" AutoEventWireup="false" CodeFile="HelpDesk.aspx.vb" Inherits="HelpDesk" title="Dorknozzle Help Desk" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<h1>Employee Help Desk Request</h1> <p>

Station Number:<br />

<asp:TextBox id="stationTextBox" runat="server" CssClass="textbox" />

</p>

<p>

Problem Category:<br />

<asp:DropDownList id="categoryList" runat="server" CssClass="dropdownmenu" />

</p>

<p>

Problem Subject:<br />

<asp:DropDownList id="subjectList" runat="server" CssClass="dropdownmenu" />

202

Extending Dorknozzle

</p>

<p>

Problem Description:<br />

<asp:TextBox id="descriptionTextBox" runat="server" CssClass="textbox" Columns="40" Rows="4" TextMode="MultiLine" />

</p>

<p>

<asp:Button id="submitButton" runat="server" CssClass="button" Text="Submit Request" /></p>

</asp:Content>

Don’t worry that the DropDownList controls don’t have items associated with them—eventually, the categories and subjects will be retrieved from a database.

When you’re finished, save your work, execute the project, and click the Help Desk link from the menu. You should see the display shown in Figure 5.45.

Figure 5.45. The Help Desk page up and running

This page gives us the opportunity to test the skin file we created earlier. If you type text into the text boxes, you’ll see that the color of the text is blue. True,

203