
C# ПІДРУЧНИКИ / c# / Premier Press - C# Professional Projects
.pdf


670 |
Project 5 |
CREATING A WEB PORTAL FOR A BOOKSTORE |
||||
|
|
|
|
|||
|
|
Table 30-1 Properties for the Controls Added to the Main Form (continued) |
||||
|
|
|
|
|
|
|
|
|
Control |
Property |
Value |
||
|
|
|
|
|
|
|
|
|
HyperLink2 |
ID |
HyperLink2 |
||
|
|
|
|
|
Text |
Operating Systems |
|
|
|
|
|
NavigateURL |
ConstructionForm.aspx |
|
|
|
|
|
BackColor |
#FF80FF |
|
|
HyperLink3 |
ID |
HyperLink3 |
||
|
|
|
|
|
Text |
RDBMS |
|
|
|
|
|
NavigateURL |
ConstructionForm.aspx |
|
|
|
|
|
BackColor |
#FF80FF |
|
|
HyperLink4 |
ID |
HyperLink4 |
||
|
|
|
|
|
Text |
Networking |
|
|
|
|
|
NavigateURL |
ConstructionForm.aspx |
|
|
|
|
|
BackColor |
#FF80FF |
|
|
HyperLink5 |
ID |
HyperLink5 |
||
|
|
|
|
|
Text |
Internet |
|
|
|
|
|
NavigateURL |
ConstructionForm.aspx |
|
|
|
|
|
BackColor |
#FF80FF |
|
|
Button |
|
ID |
btnGo |
|
|
|
|
|
|
Text |
Go |
|
|
List |
|
ID |
lstType |
|
|
|
|
|
|
Items |
All |
|
|
|
|
|
|
Author |
|
|
|
|
|
|
Title |
|
|
|
|
|
|
ISBN Number |
|
|
|
|
|
|
Category |
|
|
Table1 |
|
ID |
Table1 |
|
|
|
|
|
|
BorderStyle |
Outset |
|
|
|
|
|
ForeColor |
Purple |
|
|
|
|
|
BackColor |
#FF80FF |
|
|
|
|
|
Rows |
TableRow0 |
|
|
|
|
|
|
TableRow1 |
|
|
TableRow0 |
Cells |
TableCell0 |


672 Project 5 CREATING A WEB PORTAL FOR A BOOKSTORE
Creating the Results Form
The Results page is generated to display the results of the user’s query. To create the Results form, you need to include a DataGrid, a label, and a hyperlink control. You can name the Results form DispResultForm. After adding the controls, you need to change the properties of the Web form controls as shown in Table 30-2.
Table 30-2 Properties for the Controls Added to the Results Form
Control |
Property |
Value |
HyperLink1 |
ID |
HyperLink1 |
|
Text |
Home |
|
NavigateURL |
MainForm.aspx |
Lable1 |
ID |
lblInfo |
|
Font |
Verdana, Large |
|
ForeColor |
#400040 |
DataGrid1 |
ID |
DataGrid1 |
|
BackColor |
#E0E0E0 |
|
|
|
After adding the DataGrid control to the form, you need to add button controls to the DataGrid control. To do this, perform the following steps:
1.Select the DataGrid control to view its Properties window.
Below the Properties window, the Property Builder link is displayed.
2.Click on the Property Builder link to display the DataGrid1 Properties dialog box.
3.In the DataGrid1 Properties dialog box, select the Columns tab in the left hand pane.
4.In the Available columns: list box, expand the Button Column node.
5.Select the Select option and click on the right arrow button to add the Select button.
When you add the Select button, the text boxes in the ButtonColumn properties area become enabled.

DEVELOPING WEB SERVICE CLIENTS |
Chapter 30 |
673 |
|
|
|
|
|
6.In the Text: text box, type the text as Order.
7.In the Command name: text box, type the value as Ord.
8.In the Button Type: list box, select the value as LinkButton.
9.Click on the OK button to close the DataGrid1 Properties dialog box.
Figure 30-2 shows the DataGrid1 Properties dialog box.
FIGURE 30-2 The DataGrid1 Properties dialog box
When you create the form, the DispResultForm form looks as shown in Figure 30-3.

674 Project 5 CREATING A WEB PORTAL FOR A BOOKSTORE
FIGURE 30-3 The DispResultForm form
Creating the Orders Form
The Orders form stores the details of the book and the customers who order a book at the Web site. To do this, 1 button control, 2 hyperlink controls, 12 label controls, 1 list control, 5 RequiredFieldValidator controls, and 10 text box controls are added to the form. Name this Web form OrdersForm. In the OrdersForm form, change the properties of the controls as shown in Table 30-3.
Table 30-3 Properties for the Controls Added to the Orders Form
Control |
Property |
Value |
Button1 |
ID |
btnClear |
|
Text |
Clear |
Button2 |
ID |
btnOrder |
|
Text |
Order |
HyperLink1 |
ID |
HyperLink1 |
|
Text |
Home |
|
NavigateURL |
MainForm.aspx |
Label1 |
ID |
Label1 |
|
Text |
ISBN Number |
|
ForeColor |
Purple |

DEVELOPING WEB SERVICE CLIENTS |
Chapter 30 |
675 |
|
|
|
|
|
Table 30-3 Properties for the Controls Added to the Orders Form (continued)
Control |
Property |
Value |
Label2 |
ID |
Label2 |
|
Text |
Enter your details here |
|
ForeColor |
Purple |
|
Font |
Monotype Corsiva, Large |
Label3 |
ID |
Label3 |
|
Text |
Book Title |
|
ForeColor |
Purple |
Label4 |
ID |
Label4 |
|
Text |
Name |
|
ForeColor |
Purple |
Label5 |
ID |
Label5 |
|
Text |
Address1 |
|
ForeColor |
Purple |
Label6 |
ID |
Label6 |
|
Text |
Address2 |
|
ForeColor |
Purple |
Label7 |
ID |
Label7 |
|
Text |
City |
|
ForeColor |
Purple |
Label8 |
ID |
Label8 |
|
Text |
State |
|
ForeColor |
Purple |
Label9 |
ID |
Label9 |
|
Text |
Author |
|
ForeColor |
Purple |
List |
ID |
lstCardType |
|
Items |
Amex |
|
|
Visa |
|
|
Master |
Text Box1 |
ID |
TextBox1 |
|
TextMode |
Multiline |
|
Enabled |
False |
|
Font |
Verdana |

676 Project 5 CREATING A WEB PORTAL FOR A BOOKSTORE
Table 30-3 Properties for the Controls Added to the Orders Form (continued)
Control |
Property |
Value |
Text Box2 |
ID |
txtAddr1 |
Text Box3 |
ID |
txtAddr2 |
Text Box4 |
ID |
txtAuthor |
|
Enabled |
False |
Text Box5 |
ID |
txtCardNumber |
Text Box6 |
ID |
txtCity |
Text Box7 |
ID |
txtISBN |
|
Enabled |
False |
Text Box8 |
ID |
txtName |
Text Box9 |
ID |
txtState |
Text Box10 |
ID |
txtTitle |
RequiredFieldValidator1 |
ID |
RequiredFieldValidator1 |
|
ControlToValidate |
txtCardNumber |
|
ErrorMessage |
Please enter the Credit Card |
|
|
Number |
RequiredFieldValidator2 |
ID |
RequiredFieldValidator3 |
|
ControlToValidate |
txtName |
|
ErrorMessage |
Please enter your Name |
|
Text |
Please enter your Name |
RequiredFieldValidator3 |
ID |
RequiredFieldValidator4 |
|
ControlToValidate |
txtCardNumber |
|
ErrorMessage |
Please enter your Name |
|
Text |
Please enter your Name |
RequiredFieldValidator4 |
ID |
RequiredFieldValidator5 |
|
ControlToValidate |
txtAddr1 |
|
ErrorMessage |
Please enter the Address |
RequiredFieldValidator5 |
ID |
RequiredFieldValidator6 |
|
ControlToValidate |
txtCity |
|
ErrorMessage |
Please enter the City |

DEVELOPING WEB SERVICE CLIENTS |
Chapter 30 |
677 |
|
|
|
|
|
Table 30-3 Properties for the Controls Added to the Orders Form (continued)
Control |
Property |
Value |
RequiredFieldValidator6 |
ID |
RequiredFieldValidator7 |
|
ControlToValidate |
txtState |
|
ErrorMessage |
Please enter the State |
|
|
|
In addition to the previously mentioned controls, you need to add an sqlDataAdapter, an sqlConnection, and Dataset objects to the OrdersForm form. I have already explained the steps to include these controls to the form in Chapter 29, “Developing Web Services,” in the section “Creating a Web Service for Deepthoughts Publications.”
Figure 30-4 shows the form after it is created.
FIGURE 30-4 The OrdersForm form
Creating the Search Form
The Search form allows a user to search for records based on criteria. Therefore, the user needs to enter the criteria and a value for the criteria. To create the Search form, add a label control, two button controls, four radio buttons, and four text box controls to the form and then change the properties of the controls added to