您现在的位置: 无忧电子商务网 >> 信息学院 >> 程序开发 >> asp.net >> 正文

asp+ 输入检查(e 文,转)

作者:作者:未…    信息学院来源:网络收集    点击数:    更新时间:2006-8-28 我要参与讨论

  rty, which you check in server code to determine if all of the user input is OK.

Client Features


Most Web sites do all of their validation checks on the server. You need to write the server-based checks anyway for clients without script, so it can be hard to justify writing it all over again for rich clients.
Validation controls change all that, because almost all the duplicated logic is encapsulated in the controls. If a client with Internet Explorer 4.0 or later uses your page, it can do the same input validation that takes place on the server without you having to write any special client script.
The client side validation has a number of features:
  • Errors can appear and disappear immediately after the bad input is entered/corrected. This immediate feedback makes it much easier to correct bad input.

  • Post-back is prevented if there are errors that are detectable on the client, saving the user time and reduces hits on the server.

  • The ValidationSummary updates itself without posting back if it detects errors.

  • The ValidationSummary can optionally display a message box to the user if there are errors.

  • The client logic is all contained in a JScript library, so no ActiveX components or Java applets are used.

  • Can optionally use VBScript to perform checks involving localized date and number comparison.

  • An object model is exposed on the client to allow enhancement of client-side validation and behavior.

What is a Validator?


In order to use validators effectively, it helps to have a firm definition of what they are. Let's refine our previous definition a little:
"A validator is a control that checks one input control for a specific type of error condition and displays a description of that problem."
This is an important definition, because it means that you frequently need to use more than one validator control for each input control.
For example, if you want to check whether or not user input in a text box is (a) nonblank, (b) a valid date between a particular range and (c) less than the date in another text input control, you would want to use three validators. While this might seem cumbersome, remember that to be helpful to the user, you would want to have three different text descriptions for all these cases.
The different types of validators are listed as follows:RequiredFieldValidatorChecks that the user has entered or selected anything.

上一页  [1] [2] 

在google里搜索更多asp+ 输入检查(e 文,转)

Google
Web www.51ec.org
【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
我来说两句 对此文章发表了评论
  昵 称: *必填    ·注册用户·
  评 分: 1分 2分 3分 4分 5分     严禁发表危害国家安全、政治、黄色淫秽等内容的评论,用户需对自己在使用本网站服务过程中的行为承担法律责任。本站管理员有权保留或删除评论内容,评论内容只代表机友个人观点,与本网站立场无关。  
评 论
内 容

 
评论列表 (最新 评论仅限网友观点!)

供求信息




| 设为首页 | 加入收藏 | 关于我们 | 广告服务 | 联系方式 | 友情链接 | 版权申明