TextBox.TextChanged event not firing!

Discussion in 'ASP .Net' started by =?Utf-8?B?ZGhucml2ZXJzaWRl?=, Aug 19, 2005.

  1. Hi guys

    I'm trying to get ASP.NET to do something when someone starts typing in my
    textbox, but it doesn't want to fire the codebehind!

    I've got AutoPostBack set to to True on my textbox, and the following wireup
    in my code-behind...

    this.txtMyTextBox.TextChanged += new System.EventHandler(this.TextChange);

    TextChange function looks something like...

    private void TextChange
    {
    Response.Write("test!");
    }

    But when I type in the text box nothing happens! What have I missed?!

    Cheers


    Dan
     
    =?Utf-8?B?ZGhucml2ZXJzaWRl?=, Aug 19, 2005
    #1
    1. Advertising

  2. Try set your AutoPostBack to true.

    You do realise however, this will cause the page to post back and reload.
    Not a very nice user experience.

    Unless you loading some other data on the page, i would suggest you use
    javascript for this

    "dhnriverside" <> wrote in message
    news:...
    > Hi guys
    >
    > I'm trying to get ASP.NET to do something when someone starts typing in my
    > textbox, but it doesn't want to fire the codebehind!
    >
    > I've got AutoPostBack set to to True on my textbox, and the following
    > wireup
    > in my code-behind...
    >
    > this.txtMyTextBox.TextChanged += new System.EventHandler(this.TextChange);
    >
    > TextChange function looks something like...
    >
    > private void TextChange
    > {
    > Response.Write("test!");
    > }
    >
    > But when I type in the text box nothing happens! What have I missed?!
    >
    > Cheers
    >
    >
    > Dan
     
    Grant Merwitz, Aug 19, 2005
    #2
    1. Advertising

  3. My AutoPostBack is set to True, it still doesn't work.

    This is an intranet application, so I wanted to see what the speed was like
    - might be okay, might not :)

    Any other suggestions?

    "Grant Merwitz" wrote:

    > Try set your AutoPostBack to true.
    >
    > You do realise however, this will cause the page to post back and reload.
    > Not a very nice user experience.
    >
    > Unless you loading some other data on the page, i would suggest you use
    > javascript for this
    >
    > "dhnriverside" <> wrote in message
    > news:...
    > > Hi guys
    > >
    > > I'm trying to get ASP.NET to do something when someone starts typing in my
    > > textbox, but it doesn't want to fire the codebehind!
    > >
    > > I've got AutoPostBack set to to True on my textbox, and the following
    > > wireup
    > > in my code-behind...
    > >
    > > this.txtMyTextBox.TextChanged += new System.EventHandler(this.TextChange);
    > >
    > > TextChange function looks something like...
    > >
    > > private void TextChange
    > > {
    > > Response.Write("test!");
    > > }
    > >
    > > But when I type in the text box nothing happens! What have I missed?!
    > >
    > > Cheers
    > >
    > >
    > > Dan

    >
    >
    >
     
    =?Utf-8?B?ZGhucml2ZXJzaWRl?=, Aug 19, 2005
    #3
  4. Works fine for me:

    Try attached

    "dhnriverside" <> wrote in message
    news:...
    > My AutoPostBack is set to True, it still doesn't work.
    >
    > This is an intranet application, so I wanted to see what the speed was
    > like
    > - might be okay, might not :)
    >
    > Any other suggestions?
    >
    > "Grant Merwitz" wrote:
    >
    >> Try set your AutoPostBack to true.
    >>
    >> You do realise however, this will cause the page to post back and reload.
    >> Not a very nice user experience.
    >>
    >> Unless you loading some other data on the page, i would suggest you use
    >> javascript for this
    >>
    >> "dhnriverside" <> wrote in message
    >> news:...
    >> > Hi guys
    >> >
    >> > I'm trying to get ASP.NET to do something when someone starts typing in
    >> > my
    >> > textbox, but it doesn't want to fire the codebehind!
    >> >
    >> > I've got AutoPostBack set to to True on my textbox, and the following
    >> > wireup
    >> > in my code-behind...
    >> >
    >> > this.txtMyTextBox.TextChanged += new
    >> > System.EventHandler(this.TextChange);
    >> >
    >> > TextChange function looks something like...
    >> >
    >> > private void TextChange
    >> > {
    >> > Response.Write("test!");
    >> > }
    >> >
    >> > But when I type in the text box nothing happens! What have I missed?!
    >> >
    >> > Cheers
    >> >
    >> >
    >> > Dan

    >>
    >>
    >>
     
    Grant Merwitz, Aug 19, 2005
    #4
  5. sorry Grant.... attached? Can't see any attachments? Using the Microsoft web
    reader thingy.... can you email me? dan at musoswire.com

    Ta mate

    "Grant Merwitz" wrote:

    > Works fine for me:
    >
    > Try attached
    >
    > "dhnriverside" <> wrote in message
    > news:...
    > > My AutoPostBack is set to True, it still doesn't work.
    > >
    > > This is an intranet application, so I wanted to see what the speed was
    > > like
    > > - might be okay, might not :)
    > >
    > > Any other suggestions?
    > >
    > > "Grant Merwitz" wrote:
    > >
    > >> Try set your AutoPostBack to true.
    > >>
    > >> You do realise however, this will cause the page to post back and reload.
    > >> Not a very nice user experience.
    > >>
    > >> Unless you loading some other data on the page, i would suggest you use
    > >> javascript for this
    > >>
    > >> "dhnriverside" <> wrote in message
    > >> news:...
    > >> > Hi guys
    > >> >
    > >> > I'm trying to get ASP.NET to do something when someone starts typing in
    > >> > my
    > >> > textbox, but it doesn't want to fire the codebehind!
    > >> >
    > >> > I've got AutoPostBack set to to True on my textbox, and the following
    > >> > wireup
    > >> > in my code-behind...
    > >> >
    > >> > this.txtMyTextBox.TextChanged += new
    > >> > System.EventHandler(this.TextChange);
    > >> >
    > >> > TextChange function looks something like...
    > >> >
    > >> > private void TextChange
    > >> > {
    > >> > Response.Write("test!");
    > >> > }
    > >> >
    > >> > But when I type in the text box nothing happens! What have I missed?!
    > >> >
    > >> > Cheers
    > >> >
    > >> >
    > >> > Dan
    > >>
    > >>
    > >>

    >
    >
    >
     
    =?Utf-8?B?ZGhucml2ZXJzaWRl?=, Aug 19, 2005
    #5
  6. =?Utf-8?B?ZGhucml2ZXJzaWRl?=

    Torre

    Joined:
    Jan 28, 2008
    Messages:
    2
    I have a similar problem. I have a made a web-page with a textbox, a calendar and a radiobuttonlist (I have also tried dropdownlist.)
    Testing: I do changes in the textbox and chooses another date in the calendar. Then it's ok. The event textbox.textchanged is trigged. But if I do change the textbox and then chooses another radiobutten (or dropdown) the textbox.textchanged event is NOT trigged. Why?

    T?
     
    Torre, Jan 28, 2008
    #6
  7. =?Utf-8?B?ZGhucml2ZXJzaWRl?=

    Torre

    Joined:
    Jan 28, 2008
    Messages:
    2
    I am a little further in my investigation. I removed the SelectedIndexChanged from the radiobuttonList/DropdownList and then the Textbox.textChanged is executed. But I would it to be executed as well. First textbox.textChanged and then radiobuttonList.SelectedIndexChanged was what I wanted.
     
    Torre, Jan 28, 2008
    #7
  8. =?Utf-8?B?ZGhucml2ZXJzaWRl?=

    MaikoID

    Joined:
    Jun 9, 2010
    Messages:
    1
    I have the same problem

    Hi guys,

    I have the same thing, there are many TextBoxes with the event TextChanged set and with AutoPostback = true, and works in all browsers (Chrome, Opera, Firefox 3.6) except in IE 8, IE 6/7 I didn't test.

    I don't want to put the onblur event in all my TextBoxs because there are many pages with many TextBox that use this event.

    Description

    I'm using a masterPage,

    in the aspx
    Code:
    <asp:
    TextBox ID="txtCnpj" runat="server" CssClass="txt" Width="200px" onkeyup="Mascara(this,Cnpj)"
                                        onkeydown="Mascara(this,Cnpj)" MaxLength="18" AutoPostBack="true" ValidationGroup="txtCnpj"
                                        OnTextChanged="txtCnpj_TextChanged"></asp:TextBox>
    
    in the aspx.cs
    Code:
     protected void txtCnpj_TextChanged(object sender, EventArgs e)
            {
                if (CredorInvestimento.GetCredorInvestimento(txtCnpj.Text) != null)
                {
                    ((TextBox)sender).Text = "";
                    ((TextBox)sender).Focus();
                    rfvCnpj.ErrorMessage = "Duplicado";
                    Page.Validate(txtCnpj.ID);
                }
                else
                    txtNome.Focus();
            }
    
    Thanks!

    ps: I really doesn't like of asp.net I spend more time fixing error of developing new functions.
    ps: sorry for my english.
     
    MaikoID, Jun 9, 2010
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jorge
    Replies:
    2
    Views:
    1,274
    jorge
    May 26, 2004
  2. bill yeager

    textchanged event not firing

    bill yeager, Jun 9, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,099
    Natty Gur
    Jun 9, 2004
  3. S_K
    Replies:
    6
    Views:
    1,187
    Robert Dunlop
    Nov 8, 2007
  4. jwasp
    Replies:
    0
    Views:
    897
    jwasp
    Dec 5, 2007
  5. jorge
    Replies:
    1
    Views:
    415
    Teemu Keiski
    May 28, 2004
Loading...

Share This Page