Solved

OnTextChanged not Firing!

Posted on 2012-03-27
10
913 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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
 
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

770 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