net5:自定义验证控件服务器端验证与客户端验证的使用
2017-07-09 15:04
211 查看
原文发布时间为:2008-07-29 —— 来源于本人的百度文章 [由搬家工具导入]
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Default4 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
}
protected void Button1_Click1(object sender, EventArgs e)
{
if (Page.IsValid)
{
Label1.Text = "pass";
}
else
{
Label1.Text = "fail";
}
}
protected void txtvlue(object source, ServerValidateEventArgs args)
{
if (args.Value == "服务端")
{
args.IsValid = true;
}
else
{
args.IsValid = false;
}
}
}
--------------------------------------
<head runat="server">
<title>无标题页</title>
<script type="text/javascript">
function txtvalue(s,e)
{
if(e.Value=="客户端")
{
e.IsValid=true;
}
else
{
e.IsValid=false;
}
}
</script>
</head>
<body>
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Default4 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
}
protected void Button1_Click1(object sender, EventArgs e)
{
if (Page.IsValid)
{
Label1.Text = "pass";
}
else
{
Label1.Text = "fail";
}
}
protected void txtvlue(object source, ServerValidateEventArgs args)
{
if (args.Value == "服务端")
{
args.IsValid = true;
}
else
{
args.IsValid = false;
}
}
}
--------------------------------------
<head runat="server">
<title>无标题页</title>
<script type="text/javascript">
function txtvalue(s,e)
{
if(e.Value=="客户端")
{
e.IsValid=true;
}
else
{
e.IsValid=false;
}
}
</script>
</head>
<body>
相关文章推荐
- JS 动态增删元素 自定义验证控件的使用
- 使用服务器端数据验证控件的综合实例
- 如何:使用自定义函数对 ASP.NET 服务器控件进行验证
- [jQuery]使用jQuery.Validate进行客户端验证(中级篇-下)——不使用微软验证控件的理由
- ASP.NET中使用自定义验证控件(原作)
- [jQuery]使用jQuery.Validate进行客户端验证(中级篇-上)——不使用微软验证控件的理由
- [jQuery]使用jQuery.Validate进行客户端验证(中级篇-上)——不使用微软验证控件的理由
- 使用jQuery.Validate进行客户端验证(初级篇) 不使用微软验证控件的理由
- [jQuery]使用jQuery.Validate进行客户端验证(初级篇)——不使用微软验证控件的理由
- [jQuery]使用jQuery.Validate进行客户端验证(高级篇-上)——不使用微软验证控件的理由
- ASP.NET中使用自定义验证控件
- 如何:使用自定义函数对 ASP.NET 服务器控件进行验证
- ASP.NET中使用自定义验证控件
- 在使用CustomValidator控件验证调用客户端时注意事项
- 自定义客户端验证控件
- 自定义客户端验证控件 CustomValidator
- 使用JavaScript在客户端验证GridView控件的数据项
- ASP.NET学习笔记--自定义验证控件的使用
- Asp.net自定义验证控件CustomValidator 的使用方法
- [jQuery]使用jQuery.Validate进行客户端验证(初级篇)——不使用微软验证控件的理由