.NET Mobile输入检测 |
|||||||||||||||||
| 作者:佚名 来源:本站整理 发布时间:2008-3-14 20:35:07 | |||||||||||||||||
|
Validation Controls are used to validate the data entered by a user. Validation Controls
|
<%@ Page <script runat="server"> <Mobile:CompareValidator runat="server" |
The first form has a label with the text "Age?", an input box to input the age, and a submit button.
第一个窗口有文本为"Age?"的一个标签,一个用于输入年龄的输入框,和一个提交按钮
The second page is activated by the submit button on the first page, and displays a response.
第二页被第一页的提交按钮激活,显示了回应。
If the input validates as error, an error message is displayed.
如果输入验证为错误,就会显示错误信息
When the application runs on a mobile device, the two pages will display like this:
当程序在手机部件运行时,两页会这样显示:
Form 1 窗口1
| Age? |
Form 2 窗口2
| You are 21 years old |
The ValidationSummary Control
ValidationSummary(验证摘要)控件
The previous example used a CompareValidator control to validate an input field. The field to validate was defined by the attribute ContolToValidate.
前面的例子用了CompareValidator控件检验一个输入区域。检验区域是由ContolToValidate(检验控件).属性定义的
You can also use a ValidationSummary control with the attribute FormToValidate, to validate all the input of a form.
你也可以用有FormToValidate(检验窗口)属性的ValidationSummary(检验摘要)控件,来检验窗口的所有输入。
This way you can display a summary of errors instead of one error at the time.
用这种方法你可以显示所有错误的摘要而不是只显示一个错误。
Validation Controls Reference
检验控件参考
| Name名称 | Function功能 |
|---|---|
| CompareValidator 比较检验 | Compares two values 比较两个值 |
| CustomValidator 自定义检验 | Provides custom validation 提供自定义检验 |
| RangeValidator 验证范围 | Validates a range 验证范围 |
| RegularExpressionValidator 常规表达式检验 | Validates an expression 检验一个表达式 |
| RequiredFieldValidator 要求区域检验 | Validates required data 检验被要求的数据 |
| ValidationSummary 检验摘要 | Displays a validation summary 显示检验摘要 |
For a full control reference, including properties methods, events, and more examples, please refer to the "Mobile Reference" page.
为了解完整的控件参考,包括属性方法,事件和更多例子,请看"Mobile Reference"。
- 上一篇文章:.NET Mobile输入
- 下一篇文章:.NET Mobile列表
