Solved

OnTextChanged not Firing!

Posted on 2012-03-27
10
910 Views
Last Modified: 2012-03-30
Hello,

I've got an aspx page with TextBox and DropDownList controls on it.  The TextBox controls are populated by a javascript calendar control (Obout brand calendar control).

When I select a date in the calendar, the date appears in the TextBox, but the OnTextChanged  event for the Textbox never fires.  If I manually change the date in the TextBox, however, the OnTextChanged event DOES fire.

I've got AutoPostBack="True" set on both TextBoxes and both DropDownLists.  Also, I have set autocomplete="off" in the master page's <form>.  I have also placed an OnBlur call in the TextBox, but this event only fires when I manually change the date as well.

Any ideas?
0
Comment
Question by:adskarcox
  • 5
  • 3
  • 2
10 Comments
 
LVL 8

Expert Comment

by:gpizzuto
ID: 37773720
OnChanged occurs only if you perform a submit.
You must use javascript/vbscript to enable your OnTextChanged event.
0
 

Author Comment

by:adskarcox
ID: 37773732
gpizzuto- thank you for your reply.  Any idea how one would accomplish that?
0
 
LVL 8

Expert Comment

by:gpizzuto
ID: 37773782
Don't know Obout control, but try to enable the AutoPostBack="True" also to that
0
 

Author Comment

by:adskarcox
ID: 37773864
I am using a standard ASP.NET TextBox (not Obout - I'm only using Obout DropDownLists).  Also, AutoPostBack="True" is already set.
0
 

Author Comment

by:adskarcox
ID: 37773866
Environment: C#.NET 4.0
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 21

Expert Comment

by:masterpass
ID: 37774040
Can you try to write a javascript function for 'onchange' with similiar code as 'onblur' and see if it works ?

It would look something like this

<asp:textbox id="someid" runat="server" autopostback="true" ontextchanged="" onchange="javascript:__doPostBack('<%= someid.ClientID  %>', '');" />

Open in new window

0
 

Author Comment

by:adskarcox
ID: 37774060
masterpass - thank you for your reply.  Unfortunately, OnChange results in the same problem.  I created a javascript function (containing window.alert("in js!")) and placed it in OnChange and only get the javascript popup when I manually change the text in the textbox.
0
 
LVL 21

Expert Comment

by:masterpass
ID: 37774186
my bad! I have one more work around!

Try using the jquery .change() to handle the situation. An example is here : http://blog.darkthread.net/blogs/darkthreadtw/archive/2010/03/09/jquery1-4-fix-autocomplete-onchange-issue.aspx
0
 

Author Comment

by:adskarcox
ID: 37776649
masterpass - thanks for the link, but this using .change() didn't resolve the issue either (it didn't fire either).
0
 
LVL 21

Accepted Solution

by:
masterpass earned 500 total points
ID: 37779074
If you can get into the client API of the obout calender control, then you could trigger the change manually. Obout API should expose a method which the programmer can use after the user selects a date from calender. Try to trigger the onchange event manually there.

here is an example of a sample scenario:

http://stackoverflow.com/questions/7097848/textbox-ontextchanged-not-firing
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
A short film showing how OnPage and Connectwise integration works.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now