惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The Register - Security
The Register - Security
云风的 BLOG
云风的 BLOG
U
Unit 42
F
Fortinet All Blogs
The GitHub Blog
The GitHub Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
D
Docker
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
S
Secure Thoughts
Hacker News: Ask HN
Hacker News: Ask HN
Vercel News
Vercel News
S
Security @ Cisco Blogs
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
I
Intezer
MongoDB | Blog
MongoDB | Blog
AI
AI
MyScale Blog
MyScale Blog
Engineering at Meta
Engineering at Meta
Y
Y Combinator Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
W
WeLiveSecurity
博客园 - 叶小钗
S
SegmentFault 最新的问题
N
News | PayPal Newsroom
WordPress大学
WordPress大学
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
D
DataBreaches.Net
小众软件
小众软件
Microsoft Azure Blog
Microsoft Azure Blog
Spread Privacy
Spread Privacy
H
Help Net Security
美团技术团队
博客园 - 司徒正美
T
Threat Research - Cisco Blogs
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
K
Kaspersky official blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
V
Vulnerabilities – Threatpost
TaoSecurity Blog
TaoSecurity Blog
N
Netflix TechBlog - Medium
L
Lohrmann on Cybersecurity
J
Java Code Geeks
量子位
Martin Fowler
Martin Fowler
博客园_首页

博客园 - 梅子黄时雨

离职反思 人际交往能力:远比你想象的重要 关于晋升 生产力提升计划 向企业一样的思考 在CentOS上搭建WordPress的博客系统 Some Useful LINQ Extension Methods MVC模式 IIS7.5配置 An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode. C# 整数和byte数组互换 显式接口成员实现 C#实现的堆栈 Gridview中合并单元格,某字段的内容相同时如何只显示一个,屏蔽相同列或行的内容(转) C#winform 配置webconfig 动态SQL EXEC DELL 1520 笔记本拆机 关于表变量 华为致新员工书
ASP.NET 验证控件
梅子黄时雨 · 2011-11-09 · via 博客园 - 梅子黄时雨

今天做项目是无意中发现一个问题:

点击提交按钮的时候验证用户输入是否完整,并且提示用户操作不可回复,是否要确认改操作。

很常见的一个需求,但是问题来了,没有添加OnClientClick事件的时候,验证控件正常运行,添加了该事件提示用户操作的时候,验证控件直接失效,百度了一下发现有类似问题,给出的解决方案是手动调用页面验证的js事件

   1:  function CheckClientValidate(){      
   2:      Page_ClientValidate();
   3:      if (Page_IsValid){
   4:          return true;
   5:      }
   6:      else{
   7:          return false;
   8:      }
   9:   }

新的问题又来了,这回是可以正常验证了,但是验证的是页面所有的验证控件(页面中有不同的验证分组的)通过查看Page_ClientValidate()方法,发现可以添加参数ValidationGroup,来验证不同的分组,OK此问题解决。

还有一个问题是控件会验证两次,继续观察Page_ClientValidate()代码,发现

   1:  onclick="if(Page_ClientValidate()) return CheckAgree();if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); " 

看到没,在调用Checkgree()函数前先验证了一次页面,但如果页面没有通过验证,就会执行下面的if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate();又执行了一次验证。

坑爹呢这是,于是将button的CausesValidation设置为false。

清爽了……