Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > TextBox.TextChanged event not firing!

Reply
Thread Tools

TextBox.TextChanged event not firing!

 
 
=?Utf-8?B?ZGhucml2ZXJzaWRl?=
Guest
Posts: n/a
 
      08-19-2005
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
 
Reply With Quote
 
 
 
 
Grant Merwitz
Guest
Posts: n/a
 
      08-19-2005
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
 
=?Utf-8?B?ZGhucml2ZXJzaWRl?=
Guest
Posts: n/a
 
      08-19-2005
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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

>
>
>

 
Reply With Quote
 
Grant Merwitz
Guest
Posts: n/a
 
      08-19-2005
Works fine for me:

Try attached

"dhnriverside" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > 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

>>
>>
>>





 
Reply With Quote
 
=?Utf-8?B?ZGhucml2ZXJzaWRl?=
Guest
Posts: n/a
 
      08-19-2005
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> >> news:(E-Mail Removed)...
> >> > 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
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
Torre Torre is offline
Junior Member
Join Date: Jan 2008
Posts: 2
 
      01-28-2008
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?
 
Reply With Quote
 
Torre Torre is offline
Junior Member
Join Date: Jan 2008
Posts: 2
 
      01-28-2008
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.
 
Reply With Quote
 
MaikoID MaikoID is offline
Junior Member
Join Date: Jun 2010
Posts: 1
 
      06-09-2010
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TkInter bind() event is not firing event trigger Anthony Papillion Python 3 06-23-2010 12:55 AM
image button click event fires before click event of button Purvi T ASP .Net 0 10-19-2004 06:19 AM
Button.Init? how Do I know if click event has been fired? TextBox.TextChanged event before Button.Click in a CompositeCustomControl. jorge ASP .Net 2 05-25-2004 11:45 PM
PreRender Event occurs immediatley after Load event =?Utf-8?B?QWxpcmV6YSBaaWFp?= ASP .Net 1 02-09-2004 10:19 AM
Event On Form From Control Event Dave Wurtz ASP .Net 1 12-09-2003 10:37 PM



Advertisments