我有一个textbox控件想在改变其中的数据后实现自动查询改变DropDownList的值

解决方案 »

  1.   

    注册事件:
    this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);事件:
    private void textBox1_TextChanged(object sender, EventArgs e)
    {
        MessageBox.Show("ok");
      

  2.   

    this.textBox1.TextChanged +=new EventHandler(textBox1_TextChanged); 
    private void textBox1_TextChanged(object sender, System.EventArgs e) 

     string s=this.textBox1.Text; 
      

      

  3.   

    Winform吗?在下只知道Winform当中楼主需要的功能可以直接在TextBoxChanged事件中实现。
      

  4.   

    代码如下: 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直接刷新。
      

  5.   


    不懂,你这不是实现了,textchanged事件引起textbox2的变化,怎么还用按BUTTON啊!
      

  6.   

    主要是textchanged事件不触发
      

  7.   

    利用html的文本框<input id="text1" type="text"/>里面有个文本改变事件,直接调用js应该可以.
      

  8.   

    <asp:TextBox ID="TextBox1" runat="server" Width="160px" 
                                Text="请按此选择开始日期"  AutoPostBack ="true" ontextchanged="dtp1_TextChanged">
      

  9.   

    触发事件有,就是不触发。按任何一个Button都会触发,如何处理?
      

  10.   

    请把问题描述清楚,是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>
      

  11.   

    我是webform页面 
    textBox1中的内容改变后按回车后 能触发事件,我想在textBox1中的内容改变时不按回车键自动触发。能实现吗?
      

  12.   

    KeyUp事件可以在内容改变时不按回车键触发。