Solved

OnTextChanged not Firing!

Posted on 2012-03-27
10
906 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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Different Delete Messages 7 23
COnsume rest client 6 15
Red error squiggly on vb.net 7 14
Open a word document 23 18
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…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

746 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

13 Experts available now in Live!

Get 1:1 Help Now