运行后的页面如下:
页面代码:
后台代码:
public partial class ModalPopupLianXi : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack )
{
ModalPopupExtender1.Show();//控制模式对话框显示
}
}
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1 .Text =="zhangjiajia"&&TextBox2 .Text =="780320380")
{
ModalPopupExtender1.Hide();//控制模式对话框隐藏
Label4.Text = ">>欢迎zhangjiajia进入!";
}
else
{
Label3.ForeColor = System.Drawing.Color.Red;
Label3.Text = "用户名或密码不正确!";
}
}
}