[英]Automatically appear value in another textbox when enter value in textbox
i have problems here. 我在这里有问题。 i have two textbox: textbox1 and textbox2 : Order and Buyer.
我有两个文本框:textbox1和textbox2:订单和买方。 i want to make if user type order in textbox1 and they click enter or using mouse click, the buyer based on order will appear in textbox2.
我想确定,如果用户在textbox1中键入订单,并且他们单击enter或使用鼠标单击,则基于订单的买方将出现在textbox2中。 how to achieve this in asp.net webpage using c# ?
如何使用c#在asp.net网页中实现此目标? because it does not have keypress or something that i want to write code.
因为它没有按键或我想编写代码的东西。 i dont want to use any button because i have any other requirements must enter before click button submit.
我不想使用任何按钮,因为在单击按钮提交之前,我必须输入其他任何要求。 just those two textbox ?
只是那两个文本框? someone help ?
有人帮忙吗?
protected void TextBoxJO_TextChanged(object sender, EventArgs e)
{
DataTable dt=new DataTable();
query = "select cusfname from mescomm..CustomerLib a, mestrans..JobOrder_HD b where a.cuscode = b.customer_cd and po_no ='" + TextBoxJO.Text + "'";
cmd = new SqlCommand(query);
SqlDataReader reader = cmd.ExecuteReader();
if (reader.Read())
{
TextBoxBuyer.Text = reader["cusfname"].ToString();
reader.Close();
con.Close();
}
}
You can change text of Text box using Java script . 您可以使用Java脚本更改“文本”框的文本。 Just use your Asp:TextBox instead of
只需使用您的Asp:TextBox而不是
function change() { var t1=document.getElementById('txt1'); var t2=document.getElementById('txt2'); t2.value=t1.value; }
Enter in this Text box.. <br/> <input id='txt1' oninput="change()" /> Second Text Box... <br/> <input id='txt2' />
i used above code textchanged event for textbox and add autopostback=true. 我在文本框中使用了上面的代码textchanged事件,并添加了autopostback = true。 it works !
有用 ! thankyou :)
谢谢 :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.