net5:自定义验证控件服务器端验证与客户端验证的使用

原文发布时间为: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>

上一篇:纯 js 实现跨域接口调用 jsonp


下一篇:IT公司100题-6-根据上排给出十个数,在其下排填出对应的十个数