TexBox_TextChange不自动输入数字时触发 [英] TexBox_TextChange not Firing when a number is auto entered
本文介绍了TexBox_TextChange不自动输入数字时触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个TextBox_TextChange,当从另一个TextChange自动输入一个数字时,它应该触发。我做错了什么?
I have a TextBox_TextChange in place that should fire when a number is auto entered from another TextChange. What did I do wrong?
<td class="style27">
<asp:TextBox ID="TextBoxNCCDR" runat="server" Width="180px" AutoPostBack="True"
ontextchanged="TextBoxNCCDR_TextChanged" Enabled="True" ReadOnly="True"></asp:TextBox>
</td>
protected void TextBoxNCCDR_TextChanged(object sender, EventArgs e)
{
int a = Convert.ToInt32(TextBoxT1234.Text);
int b = Convert.ToInt32(TextBoxNCCDR.Text);
TextBoxTCNC.Text = Convert.ToString(a + b);
TextBoxTNFUG.Focus();
}
这是计算后自动编号的来源。
Here is where the auto number comes from after calculations.
protected void TextBoxNCC_TextChanged(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["PasswordConnectionString"].ConnectionString);
con.Open();
if (true)
{
SqlCommand level = new SqlCommand("Select INST_ID, Calendar from TableCOCINST where INST_ID = @INST_ID", con);
level.Parameters.Add(new SqlParameter("INST_ID", TextBoxINST_ID.Text));
SqlDataReader reader = level.ExecuteReader();
DataTable dt1 = new DataTable();
dt1.Load(reader);
foreach (DataRow dr1 in dt1.Rows)
{
string returnedLevel = (dr1[1].ToString());
int inst_id = Convert.ToInt32(dr1[0].ToString());
Session["inst_id"] = inst_id;
if (returnedLevel == "Semester")
{
int i = Convert.ToInt32(TextBoxNCC.Text);
int j = 168;
TextBoxNCCDR.Text = Convert.ToString(i / j);
}
else if (returnedLevel == "Quarter")
{
int i = Convert.ToInt32(TextBoxNCC.Text);
int j = 120;
TextBoxNCCDR.Text = Convert.ToString(i / j);
}
}
}
}
}
推荐答案
I得到它了!!我解决了这个问题!!!!
I got it!! I solved the issue!!!!
protected void TextBoxNCC_TextChanged(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["PasswordConnectionString"].ConnectionString);
con.Open();
if (true)
{
SqlCommand level = new SqlCommand("Select INST_ID, Calendar from TableCOCINST where INST_ID = @INST_ID", con);
level.Parameters.Add(new SqlParameter("INST_ID", TextBoxINST_ID.Text));
SqlDataReader reader = level.ExecuteReader();
DataTable dt1 = new DataTable();
dt1.Load(reader);
foreach (DataRow dr1 in dt1.Rows)
{
string returnedLevel = (dr1[1].ToString());
int inst_id = Convert.ToInt32(dr1[0].ToString());
Session["inst_id"] = inst_id;
if (returnedLevel == "Semester")
{
int i = Convert.ToInt32(TextBoxNCC.Text);
int j = 168;
TextBoxNCCDR.Text = Convert.ToString(i / j);
int a = Convert.ToInt32(TextBoxT1234.Text);
int b = Convert.ToInt32(TextBoxNCCDR.Text);
TextBoxTCNC.Text = Convert.ToString(a + b);
TextBoxTNFUG.Focus();
}
else if (returnedLevel == "Quarter")
{
int i = Convert.ToInt32(TextBoxNCC.Text);
int j = 120;
TextBoxNCCDR.Text = Convert.ToString(i / j);
int a = Convert.ToInt32(TextBoxT1234.Text);
int b = Convert.ToInt32(TextBoxNCCDR.Text);
TextBoxTCNC.Text = Convert.ToString(a + b);
TextBoxTNFUG.Focus();
}
}
}
}
}
这篇关于TexBox_TextChange不自动输入数字时触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文