zoukankan
html css js c++ java
CustomValidator控件原来还可以这样用。
没看到自己还不知道这种方法。
<%
@ Page Language
=
"
VB
"
AutoEventWireup
=
"
false
"
CodeFile
=
"
Default.aspx.vb
"
Inherits
=
"
_Default
"
%>
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<
html
xmlns
="http://www.w3.org/1999/xhtml"
>
<
head
runat
="server"
>
<
title
>
无标题页
</
title
>
<
script
type
="text/javascript"
>
<!--
//
--><![CDATA[//><!--
function
ValidationFunctionName(source, arguments)
{
var
infoBoard;
infoBoard
=
document.getElementById(
"
backMsg
"
);
infoBoard.innerText
=
'查询中
';
var
userName
=
document.getElementById(
"
UserName
"
);
var
oBao
=
new
ActiveXObject(
"
Microsoft.XMLHTTP
"
);
oBao.open(
"
Get
"
,
"
Check.aspx?username=
"
+
userName.value,
false
);
oBao.send();
var
strResult
=
oBao.responseText;
//
如果返回 1 就代表可以使用,否则不能通过验证
if
(Number(strResult)
==
1
)
arguments.IsValid
=
true
;
else
arguments.IsValid
=
false
;
//
infoBoard.innerText='提示2';
}
//
--><!]]></script>
</
head
>
<
body
>
<
form id
=
"
form1
"
runat
=
"
server
"
>
<
div id
=
"
backMsg
"
></
div
>
<
div
>
<
asp:TextBox ID
=
"
UserName
"
runat
=
"
server
"
></
asp:TextBox
>
<
asp:CustomValidator ID
=
"
CustomValidator1
"
runat
=
"
server
"
ControlToValidate
=
"
UserName
"
ClientValidationFunction
=
"
ValidationFunctionName
"
ErrorMessage
=
"
被注册的用户名
"
></
asp:CustomValidator
>
<
asp:Button ID
=
"
Button1
"
runat
=
"
server
"
Text
=
"
Button
"
/><
br
/>
</
div
>
<
asp:TextBox ID
=
"
TextBox1
"
runat
=
"
server
"
></
asp:TextBox
>
</
form
>
</
body
>
</
html
>
查看全文
相关阅读:
交叉验证概述
【Python那些事儿之十】range()和xrange()
Numpy基础笔记
matplotlib中使用imshow绘制二维图
Django+Django-Celery+Celery的整合实战
Nginx+uWSGI+Django部署web服务器
uwsgi
uwsgi 神器问题
disagrees about version
协议基础:SMTP:使用Telnet学习SMTP协议
原文地址:https://www.cnblogs.com/LCX/p/563903.html
最新文章
平凡的世界,有感而发
浅谈Cocos2d-js ListView滑动防止误触
Cocos 踩过的坑
浅谈垃圾回收机制
浅谈UE4引擎
lua相关的小知识
堆和栈的概念和区别
浅谈JS中的原型对象和原型链
浅谈JS中的typeof和instanceof的区别
cocos2d-js 小知识
热门文章
Hibernate与Jpa的关系(2)
Hibernate与Jpa的关系(1)
RabbitMQ安装记录(CentOS)
Submin1安装记录(CentOS5)
55分钟学会正则表达式
Python lambda介绍
python lambda表达式简单用法
深入理解Lambda
小微贷款业务为什么要进行交叉验证?
留一法交叉验证和普通交叉验证有什么区别?
Copyright © 2011-2022 走看看