如何验证更新面板JavaScript中的文本框? [英] How to validate a textbox inside the update panel javascript?

查看:59
本文介绍了如何验证更新面板JavaScript中的文本框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的先生,

我正在asp.net 2.0中开发一个Web应用程序.如何在更新面板javascript中验证文本框?

-Debapriya

Dear Sir,

I am develop a web application in asp.net 2.0.How to validate a textbox inside the update panel javascript?

-Debapriya

推荐答案

纯Javascript验证在ASP.NET中几乎肯定是错误的,它仅检查客户端,而不检查服务器,这是不安全的. />
ASP.NET具有内置的验证控件:
MSDN验证控件 [
Pure Javascript validation is almost certainly wrong in ASP.NET, it only checks on the client, not the server, and a this is insecure.

ASP.NET has validation controls built in:
MSDN Validation Controls[^]
All of these generate the JavaScript and validate on the server too (except the CustomValidator: You write the server and client scripts for yourself). The validators are:


  • RequiredFieldValidator- The validated field must not be blank
  • CompareValidator - Compares against a value, or value of another control
  • RangeValidator - Makes sure the value is in a pre-defined range
  • RegularExpressionValidator - Makes sure the value matches a regex
  • CustomValidator - Complex Validation you define yourself.
  • ValidationSummary - Allows you to summarise validation failures


您的问题不太清楚,但是听起来您想在更新面板开始工作时通过JavaScript进行验证/完成.如果是这样,请看一下这篇文章:如何处理&更新面板更新后 [ ^ ]

如果这是通过Javascript对文本框进行的常规验证,则只需找到文本框控件并验证值即可.
Your question is not quite clear, but it sounds like you want to validate via JavaScript while Update Panel start working/finishes. If so, have a look at this article: How to handle before & after update panel update[^]

If it''s a normal validation for a textbox via Javascript then you need to simply find the textbox control and validate the value.


这篇关于如何验证更新面板JavaScript中的文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆