Link to home
Start Free TrialLog in
Avatar of adskarcox
adskarcoxFlag for United States of America

asked on

OnTextChanged not Firing!

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?
Avatar of Giuseppe Pizzuto
Giuseppe Pizzuto
Flag of Italy image

OnChanged occurs only if you perform a submit.
You must use javascript/vbscript to enable your OnTextChanged event.
Avatar of adskarcox

ASKER

gpizzuto- thank you for your reply.  Any idea how one would accomplish that?
Don't know Obout control, but try to enable the AutoPostBack="True" also to that
I am using a standard ASP.NET TextBox (not Obout - I'm only using Obout DropDownLists).  Also, AutoPostBack="True" is already set.
Environment: C#.NET 4.0
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

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.
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
masterpass - thanks for the link, but this using .change() didn't resolve the issue either (it didn't fire either).
ASKER CERTIFIED SOLUTION
Avatar of masterpass
masterpass
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial