您现在的位置是:网站首页> 编程资料编程资料

使用updatepanel局部刷新实现注册时对用户名的检测示例_实用技巧_

2023-05-24 236人已围观

简介 使用updatepanel局部刷新实现注册时对用户名的检测示例_实用技巧_

通过将控件放入到updatepanel中,实现局部刷新。
前台代码:

复制代码 代码如下:


    //必须有且写在updatepanel前面


  
  
  


后台代码:

复制代码 代码如下:

protected void btn_Click(object sender, EventArgs e)
{
  if (this.txtname.Text == "user1")
  {
    this.tip.Text = "用户名已存在";
  }
  else
  {
    this.tip.Text = "用户名可用";
  }
}

-六神源码网