温州布衣

用户名存在无刷新判断 ajax.dll

webcoiig 配置

     

 

javascript代码部分:

 

 

客户名称:<input id="txt_Custname" runat="server" onblur="SearchCustName()" type="text" />

<span style="color: #ff0000">*<label id="lable"></label></span>


   News.cs代码部分:
    public string GetCustName(string Custname)
    {
        string sql = "select * from Customers where Cust_name=''" + Custname + "''";
        SqlDataReader dr = co.GetDataReader(sql);
        if (dr.Read())
        {
            return "提示:该用户已经存在,请重新输入!";
        }
        else
        {
            return " ";
        }
    }       

 

页面代码

 

        News bll = new News();

        protected void Page_Load(object sender, EventArgs e)
        {
            Ajax.Utility.RegisterTypeForAjax(typeof(WebForm1)); 
        }

        [Ajax.AjaxMethod()]
        public string GetCustName()
        {
            return bll.GetSortCount().ToString();
        }

posted on 2009-03-19 09:38  温州布衣  阅读(301)  评论(0)    收藏  举报