1 / 14

学习情境 4-2

学习情境 4-2. “蚂蚁商城”应用系统用户注册信息有效性验证. 教学目标: 会正确使用验证控件 教学重点: 使用 CompareValidator 、 RegularExpressionValidator 、 RequiredFieldValidator 、 RangeValidator 等验证控件验证用户输入的数据 教学难点: 验证表达式的使用 教学课时: 8 学时. 工作任务. 在设计“蚂蚁商城”系统用户注册界面的过程中,为了避免用户在录入的过程中输入错误,可以先对用户所输入的信息进行验证。.

yoko
Download Presentation

学习情境 4-2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 学习情境4-2 “蚂蚁商城”应用系统用户注册信息有效性验证

  2. 教学目标: • 会正确使用验证控件 • 教学重点: • 使用CompareValidator、RegularExpressionValidator、RequiredFieldValidator、RangeValidator等验证控件验证用户输入的数据 • 教学难点: • 验证表达式的使用 • 教学课时:8学时

  3. 工作任务 • 在设计“蚂蚁商城”系统用户注册界面的过程中,为了避免用户在录入的过程中输入错误,可以先对用户所输入的信息进行验证。

  4. 使用RequiredFieldValidator控件验证Email、登录密码、手机号码、姓名、联系地址、邮编、身份证号等必须输入的信息;使用RequiredFieldValidator控件验证Email、登录密码、手机号码、姓名、联系地址、邮编、身份证号等必须输入的信息; • 使用CompareValidator验证两次录入的密码是否一致; • 使用RegularExpressionValidator验证Email、手机号码、邮编、身份证号用户录入的信息格式是否正确。

  5. 1.在系统解决方案中,双击打开任务4.1中建好的注册模块窗体文件UserReg.aspx,并选择“设计”模式,如图4-12所示。。1.在系统解决方案中,双击打开任务4.1中建好的注册模块窗体文件UserReg.aspx,并选择“设计”模式,如图4-12所示。。

  6. 2.在工具箱中的“验证”栏中选择RequiredFieldValidator控件添加到Email、登录密码、手机号码、姓名、联系地址、邮编、身份证号文本框的右侧验证必须输入的信息,并根据表4.18设置控件属性。2.在工具箱中的“验证”栏中选择RequiredFieldValidator控件添加到Email、登录密码、手机号码、姓名、联系地址、邮编、身份证号文本框的右侧验证必须输入的信息,并根据表4.18设置控件属性。

  7. 3.继续在工具箱中的“验证”栏中选择CompareValidator控件添加到再次输入密码文本框的右侧,比较两次录入的密码是否一致,并根据表4.19设置控件属性。3.继续在工具箱中的“验证”栏中选择CompareValidator控件添加到再次输入密码文本框的右侧,比较两次录入的密码是否一致,并根据表4.19设置控件属性。

  8. 4.最后在工具箱中的“验证”栏中选择RegularExpressionValidator控件添加到Email、手机号码、邮编、身份证号文本框的右侧,验证用户录入的信息格式是否正确,并根据表4.20设置控件属性。4.最后在工具箱中的“验证”栏中选择RegularExpressionValidator控件添加到Email、手机号码、邮编、身份证号文本框的右侧,验证用户录入的信息格式是否正确,并根据表4.20设置控件属性。

  9. RequiredFieldValidator控件的主要属性

  10. ControlToCompare控件的主要属性

  11. RegularExpressionValidator控件的正则表达式

  12. 实践与练习 1.设计一个如图4-16所示的页面,具体要求如下: • 其中每一项都必须填写。 • 密码和确认密码要完全一致。 • 姓名必须是中文。 • 固定电话、IP地址、Emal、邮编必须符合我国规范要求。

More Related