zoukankan      html  css  js  c++  java
  • 关于如何在.cs页面中写弹出窗口

    其语法为:

     ClientScript.RegisterStartupScript(this.GetType(), "", "alert('用户名或密码错误!');", true);

    下面给出一个登录窗口点登陆后的单击按钮后台代码,用户名和密码都正确,转向admin.aspx 页面,否则错误弹出窗口

     protected void LoginButton_Click1(object sender, EventArgs e)
        {
            if (UserName.Text.Trim().Equals("mr") && Password.Text.Trim().Equals("123"))
            {
                Session["username"] = UserName.Text.Trim();
                if (RememberMe.Checked)
                {
                    if (Request.Cookies["username"] == null)
                    {
                        Response.Cookies["username"].Expires = DateTime.Now.AddDays(30);
                        Response.Cookies["userpwd"].Expires = DateTime.Now.AddDays(30);
                        Response.Cookies["username"].Value = UserName.Text.Trim();
                        Response.Cookies["userpwd"].Value = Password.Text.Trim();
                    }
                }
                Response.Redirect("admin.aspx");
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", "alert('用户名或密码错误!');", true);
            }
        }
  • 相关阅读:
    第三周学习进度
    四则运算之结对开发
    第二周学习进度
    单元测试
    构建之法阅读笔记03
    本周学习进度
    四则运算三
    构建之法阅读笔记02
    本周学习进度
    按照Right-BICEP要求设计的测试用例
  • 原文地址:https://www.cnblogs.com/weicleer/p/2786306.html
Copyright © 2011-2022 走看看