Đang chuẩn bị liên kết để tải về tài liệu:
ASP.NET 4 Unleased - p 18

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

ControlToValidate-ID của các trường biểu mẫu xác nhận. . Text-Các thông báo lỗi hiển thị khi xác nhận không thành công. . MinimumValue-Giá trị tối thiểu của dãy xác nhận. . MaximumValue-Giá trị tối đa phạm vi xác nhận. . Type-Các loại so với thực hiện. Giá trị có thể là String, Integer, Double, Date, và tiền tệ. Ví dụ, các trang trong Ví dụ 3,9 bao gồm một RangeValidator đó xác nhận một trường mẫu tuổi | 144 CHAPTER 3 Using the Validation Controls ControlToValidate The ID of the form field validated. Text The error message displayed when validation fails. Minimumvalue The minimum value of the validation range. Maximumvalue The maximum value of the validation range. Type The type of comparison to perform. Possible values are String Integer Double Date and Currency. For example the page in Listing 3.9 includes a RangeValidator that validates an age form field. If you do not enter an age between 5 and 100 a validation error displays see Figure 3.7 . LISTING 3.9 ShowRangeValidator.aspx @ Page Language C DOCTYPE html PUBLIC - W3C DTD XHTML 1.0 Transitional EN http www.w3.org TR xhtml1 DTD xhtml1-transitional.dtd html xmlns http www.w3.org 1999 xhtml head id Head1 runat server title Show RangeValidator title head body form id form1 runat server div asp Label id lblAge Text Age AssociatedControlID txtAge Runat server asp TextBox id txtAge Runat server asp RangeValidator id reqAge ControlToValidate txtAge Text Invalid Age MinimumValue 5 MaximumValue 100 Type Integer Runat server br br asp Button From the Library of Wow eBook Using the RangeValidator Control 145 id btnSubmit Text Submit Runat server div form body html FIGURE 3.7 Validating a form field against a range of values. 3 If you submit the form in Listing 3.9 with an age less than 5 or greater than 100 the validation error message displays. The validation message also displays if you enter a value that is not a number. If the value entered into the form field cannot be converted into the data type represented by the RangeValidator control s Type property the error message displays. If you don t enter any value into the age field and submit the form no error message displays. If you want to require a user to enter a value you must associate a RequiredFieldValidator with the form field. Don t forget to set the Type property when using the RangeValidator control. By default the Type property has the value String and .

TÀI LIỆU LIÊN QUAN
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.