tailieunhanh - Server Validations Extract

Comparing Server and Client Validations Consider the page of the Honest John Web site again. The user is expected to enter the details of an employee: name, employee ID, position, and role. | Comparing Server and Client Validations Consider the page of the Honest John Web site again. The user is expected to enter the details of an employee name employee ID position and role. All the text boxes should be mandatory. The employee ID should be a positive integer. In a Windows Forms application you would use the Validating event to ensure the user typed something into the First Name and Last Name text boxes and that the employee ID value was numeric. Web forms do not have a Validating event which means that you cannot use the same approach. Server Validation If you examine the TextBox class you will notice that it publishes the TextChanged event. This event runs the next time the form is posted back to the server after the user changes the text typed in the text box. Like all Web Server control events the TextChanged event runs at the Web server. This action involves transmitting data from the Web browser to the server processing the event at the server to validate the data and then packaging up any validation errors as part of the HTML response sent back to the client. If the validation being performed is complex or requires processing that can only be performed at the Web server such as ensuring that an Employee ID the user types in exists in a database this might be an acceptable technique. But if you are simply inspecting the data in a single text box in isolation such as making sure that the user types a positive integer into an Employee ID text box performing this type of validation of the Web server could impose an unacceptable overhead why not perform this check in the browser on the client computer and save a network round-trip Client Validation The Web Forms model provides for client-side validation through the use of validation controls. If the user is running a browser such as Microsoft Internet Explorer 4 or later which supports dynamic HTML these controls generate JavaScript code that runs in the browser and avoids the need to

TÀI LIỆU LIÊN QUAN
10    127    1
6    150    1
7    127    1
5    125    1
6    127    1
6    115    1
6    122    1
6    174    1
7    122    1
crossorigin="anonymous">
Đã 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.