zoukankan      html  css  js  c++  java
  • 给button端添加客户端方法

    //首先要在PageLoad()事件中注册属性
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Button1.Attributes.Add("onclick", "return checkSame()");//为Button1添加onclick()事件 ,Button为服务器控件
            }//注意:checkSame()这是一个写在aspx面页的js函数,必须有返回值,为:true 或 false
        }

    //接着写Button1的onclick事件,如果刚才的checkSame()返回为true则招行下面的事件,否则不执行

        protected void Button1_Click(object sender, ImageClickEventArgs e)
        {
            SqlParameter[] Params = new SqlParameter[2];
            Params[0] = dbs.MakeInParams("@uid", SqlDbType.VarChar, 10, Session["Uid"].ToString());
            Params[1] = dbs.MakeOutParms("@Upwd", SqlDbType.VarChar, 10);
            if (dbs.ExecuteNonQuery(CommandType.StoredProcedure, "selectPwd", Params) > 0)
            {
                string userPwd = Params[1].Value.ToString();
                if (userPwd != this.old_pwd.Text)
                {
                    Response.Write("<script>alert('原始密码错误!')</script>");
                }
                else
                {
                  
                }
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('操作失败!')</script>");
            }

        }

  • 相关阅读:
    Python编码风格
    CI持续集成—记一次jenkins安装及ldap配置
    mysql主从同步失败处理
    redis优化
    sysbench
    Ubuntu12.04 Installation and Subversion(svn)
    MySQL 5.7 CLUSTER NDB 7.5 创建磁盘表 undo logfile group tablespace 内存表修改为磁盘表
    Java异步调用Future对象
    Java宝典(二)
    Java宝典(一)
  • 原文地址:https://www.cnblogs.com/hyd309/p/1453899.html
Copyright © 2011-2022 走看看