用户名存在无刷新判断 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();
}
浙公网安备 33010602011771号