protected void txtStu_TextChanged(object sender, EventArgs e)
{
Label1.Text = "";
if (txtJsmc.Text != null && txtJsmc.Text.Trim() != "")
{
try
{
int.Parse(txtJsmc.Text);
}
catch
{
Label1.Text = "教室名不符合规范!";
return;
}
if (Ajaxid(txtJsmc.Text))
{
Label1.Text = "此教室名已存在,请检查您的输入!";
txtJssm.Text = "";
Button1.Enabled = false;
}
else
{
Button1.Enabled = true;
//CommunityFulfilByType cf = new CommunityFulfilByType();
//DataTable dt2 = new DataTable();
//dt2 = cf.SelectGraduateParticularByComid(txtStu.Text);
//txtXm.Text = dt2.Rows[0]["gp_name"].ToString();
//txtBb.Text = dt2.Rows[0]["c_name"].ToString();
}
}
} public Boolean Ajaxid(string s)
{
string sql = "select * from ClassRoom where cr_name =" + s;
SqlConnection con = new SqlConnection(ConnectionStr.ConnectionString);
SqlCommand cmd = new SqlCommand(sql, con);
SqlDataAdapter adp = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
try
{
adp.Fill(dt);
if (dt.Rows.Count == 0)
return false;
else
return true;
}
catch (Exception ex)
{
throw ex;
}
}现在我的页面有这样一个textbox,我要的效果是输入完不用做其他事情直接跳出label1的东西,不然每次都要输入完成按其他的东西才跳出来!!
AUTOPOSTBACK 我已经设置了true了
{
Label1.Text = "";
if (txtJsmc.Text != null && txtJsmc.Text.Trim() != "")
{
try
{
int.Parse(txtJsmc.Text);
}
catch
{
Label1.Text = "教室名不符合规范!";
return;
}
if (Ajaxid(txtJsmc.Text))
{
Label1.Text = "此教室名已存在,请检查您的输入!";
txtJssm.Text = "";
Button1.Enabled = false;
}
else
{
Button1.Enabled = true;
//CommunityFulfilByType cf = new CommunityFulfilByType();
//DataTable dt2 = new DataTable();
//dt2 = cf.SelectGraduateParticularByComid(txtStu.Text);
//txtXm.Text = dt2.Rows[0]["gp_name"].ToString();
//txtBb.Text = dt2.Rows[0]["c_name"].ToString();
}
}
} public Boolean Ajaxid(string s)
{
string sql = "select * from ClassRoom where cr_name =" + s;
SqlConnection con = new SqlConnection(ConnectionStr.ConnectionString);
SqlCommand cmd = new SqlCommand(sql, con);
SqlDataAdapter adp = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
try
{
adp.Fill(dt);
if (dt.Rows.Count == 0)
return false;
else
return true;
}
catch (Exception ex)
{
throw ex;
}
}现在我的页面有这样一个textbox,我要的效果是输入完不用做其他事情直接跳出label1的东西,不然每次都要输入完成按其他的东西才跳出来!!
AUTOPOSTBACK 我已经设置了true了
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货