textbox如何在不失去焦点的情况下触发ontextchange事件 我有一个textbox控件想在改变其中的数据后实现自动查询改变DropDownList的值 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 注册事件:this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);事件:private void textBox1_TextChanged(object sender, EventArgs e){ MessageBox.Show("ok");} this.textBox1.TextChanged +=new EventHandler(textBox1_TextChanged); private void textBox1_TextChanged(object sender, System.EventArgs e) { string s=this.textBox1.Text; } Winform吗?在下只知道Winform当中楼主需要的功能可以直接在TextBoxChanged事件中实现。 代码如下: private void InitializeComponent() { this.TextBox1.TextChanged += new System.EventHandler(this.TextBox1_TextChanged); this.Load += new System.EventHandler(this.Page_Load); }protected void TextBox1_TextChanged(object sender, EventArgs e) { TextBox2.Text = TextBox1.Text; }在TextBox1中填写数据时,TextBox2没有数据,任意按一个Button,Textbox2就刷新了,我的意思是不按Button直接刷新。 不懂,你这不是实现了,textchanged事件引起textbox2的变化,怎么还用按BUTTON啊! 主要是textchanged事件不触发 利用html的文本框<input id="text1" type="text"/>里面有个文本改变事件,直接调用js应该可以. <asp:TextBox ID="TextBox1" runat="server" Width="160px" Text="请按此选择开始日期" AutoPostBack ="true" ontextchanged="dtp1_TextChanged"> 触发事件有,就是不触发。按任何一个Button都会触发,如何处理? 请把问题描述清楚,是web还是winform,如果是后者webform:public Form2(){ InitializeComponent(); this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);}protected void textBox1_TextChanged(object sender, EventArgs e){ textBox2.Text = textBox1.Text;}如果是前者web:function test(){ document.getElementById("<%=TextBox2.ClientID%>").value=document.getElementById("<%=TextBox1.ClientID%>").value;}<asp:TextBox ID="TextBox1" runat="server" onkeyup="test()"></asp:TextBox><asp:TextBox ID="TextBox2" runat="server" ></asp:TextBox> 我是webform页面 textBox1中的内容改变后按回车后 能触发事件,我想在textBox1中的内容改变时不按回车键自动触发。能实现吗? KeyUp事件可以在内容改变时不按回车键触发。 求助大家帮忙!请大家看看,谢谢! 求助SQLSERVER2000作业调度计算下次执行日期和时间的算法 vs2005中,c#播放wav文件报错 如何获取mht文件中的plmm的照片 如果用静态command,connection对象,在调用的时候是不是会起冲突,会重叠使用comm对象 在C#中,如何把字符串映射为枚举类中的一个类型? 如何 获取远程计算机的进程啊>(没分了,不好意思啊) 如何用副窗口的关闭来关闭主窗口 Win10的统一从技术上怎么理解? C#关于Excel导出页面数据,方法已经有了,目前就是页面数据遇到问题了 關于VS2005的一個調試現像 救命啊!!!
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);事件:
private void textBox1_TextChanged(object sender, EventArgs e)
{
MessageBox.Show("ok");
}
private void textBox1_TextChanged(object sender, System.EventArgs e)
{
string s=this.textBox1.Text;
}
{
this.TextBox1.TextChanged += new System.EventHandler(this.TextBox1_TextChanged);
this.Load += new System.EventHandler(this.Page_Load);
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
TextBox2.Text = TextBox1.Text;
}在TextBox1中填写数据时,TextBox2没有数据,任意按一个Button,Textbox2就刷新了,我的意思是不按Button直接刷新。
不懂,你这不是实现了,textchanged事件引起textbox2的变化,怎么还用按BUTTON啊!
Text="请按此选择开始日期" AutoPostBack ="true" ontextchanged="dtp1_TextChanged">
public Form2()
{
InitializeComponent();
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);}protected void textBox1_TextChanged(object sender, EventArgs e)
{
textBox2.Text = textBox1.Text;
}如果是前者web:
function test()
{
document.getElementById("<%=TextBox2.ClientID%>").value=document.getElementById("<%=TextBox1.ClientID%>").value;
}<asp:TextBox ID="TextBox1" runat="server" onkeyup="test()"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server" ></asp:TextBox>
textBox1中的内容改变后按回车后 能触发事件,我想在textBox1中的内容改变时不按回车键自动触发。能实现吗?