如何在ASP.Net中的OnClientClick事件之前调用必需的字段验证程序 [英] How to Invoke Required Field validator before OnClientClick Event in ASP.Net

查看:56
本文介绍了如何在ASP.Net中的OnClientClick事件之前调用必需的字段验证程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有五个带有必填字段验证器的文本框。和Onclientclick的一个按钮我需要显示一些消息。



这里我需要在客户端点击消息框之前检查requiredfield验证器



我正在使用ASP.Net



请帮我实现这个



谢谢

Mohan

Hi,

I have five textbox with required field validator. And one Button with Onclientclick i need to show some message.

Here i need to check the requiredfield validator before the client click msg box

I am using ASP.Net

Please help me to achive this

Thanks
Mohan

推荐答案

在您的客户端点击函数调用 Page_ClientValidate

示例代码

in your on client click function call Page_ClientValidate
sample code
<script type="text/javascript" language="javascript">
function ClientClickFunction() {
if (Page_ClientValidate())
{
// do sumething
}else
{
// do something
}
}
</script>


这篇关于如何在ASP.Net中的OnClientClick事件之前调用必需的字段验证程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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