TAILIEUCHUNG - Building a More Complex Application

Building a More Complex Application In this section, you'll see a more complex Web form that uses Label, TextBox, RadioButtonList, DropDownList | Building a More Complex Application In this section you ll see a more complex Web form that uses Label TextBox RadioButtonList DropDownList and RequiredFieldValidator controls. The form will prompt the user for their name a required field favorite season spring summer fall or winter and gender male or female . The form will also feature a Button control which when pressed will set the Text property of one of the Label controls to a string containing the user s name gender and favorite season. Figure shows how your final form will appear. Figure The appearance of the final form Perform the following steps 1. To create the new project select File New Project in VS .NET. Select Visual C Projects from the Project Types area on the left of the New Project dialog box and select ASP .NET Web Application from the Templates area on the right. Enter http localhost MyWeb-Application2 in the Location field. VS .NET will display a blank form to which you can add controls. 2. Now add the four Label controls listed in Table to your blank form. This table shows the ID and Text property to set for each of your Label controls. Table Label CONTROLS ID PROPERTY Text PROPERTY HelloLabel Hello NameLabel Enter your name SeasonLabel Favorite season Table Label CONTROLS ID PROPERTY Text PROPERTY SexLabel Sex 3. Next add a TextBox control to the right of NameLabel. Set the ID property for your TextBox control to NameTextBox. The user will enter their name in NameTextBox when the form is run. 4. We want the user to have to enter their name if they don t we want to display a message prompting them to do so. To achieve this you use a RequiredFieldValidator control. Add a RequiredFieldValidator control below NameTextBox. Set the ID property for your Required-FieldValidator control to NameRequiredFieldValidator. Set the Text property to You must enter your name Finally set the ControlToValidate property to NameTextBox. 5. Next add a RadioButtonList control to the right .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.