Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
C# 2008 Step by Step.pdf
Скачиваний:
16
Добавлен:
25.03.2016
Размер:
13.96 Mб
Скачать

596

Part VI Building Web Applications

Dynamic HTML and Error Messages

If you are viewing the page with a browser that supports dynamic HTML, you can dis-

play the validation summary data in a message box in addition to or rather than on the Web form. To do this, set the ShowMessageBox property of the ValidationSummary

control to True. At run time, if any validation errors occur, the error messages will be

displayed in a message box. If the Web browser does not support dynamic HTML, the value of the ShowMessageBox property is ignored (it defaults to False).

If you want to continue to the next chapter

Keep Visual Studio 2008 running, and turn to Chapter 29.

If you want to exit Visual Studio 2008 now

On the File menu, click Exit. If you see a Save dialog box, click Yes and save the project.

Chapter 28 Quick Reference

To

Do this

Perform server-side validation of

Use events belonging to server controls, for example, the

user input

TextChanged event of the TextBox control.

 

 

Perform client-side validation of

Use a validation control. Set the ControlToValidate property to the

user input

control to be validated, and set the ErrorMessage property to an

 

error message to be displayed. Verify that the EnableClientScript

 

property is set to True.

 

 

Force the user to enter a value in a

Use a RequiredFieldValidator control.

text box

 

 

 

Check the type and range of data

Use a RangeValidator control. Set the Type, MaximumValue, and

values entered into a text box

MinimumValue properties as required.

 

 

Display a summary of validation error

Use a ValidationSummary control. Verify that the ShowSummary

messages

property is set to True. Set the ShowMessageBox property to True

 

if you want browsers that support dynamic HTML to display the

 

error messages in a message box.

 

 

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]