Link to home
Start Free TrialLog in
Avatar of Dipti Dasari
Dipti Dasari

asked on

Unable to trigger Autopostback for a asp textbox when picking date from calendar but autopostback works when user manually enters a date

I had this question after viewing Textbox Textchanged event doesn't fire....
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Put the following inside at the end the body part of your page  (not in the HEAD section), idealy just before the closing < / body> tag:
<script>
   var oldStartDate = _$("txtStartDate").value;
   var oldEndDate =_$("txtEndDate").value;
   var _$ = function(id) { return document.getElementById(id); }
   setTimerOut(function() {
         if( _$("txtStartDate").value != oldStartDate) _$("txtStartDate").change();
         if( _$("txtEndDate").value != oldEndDate) _$("txtStartDate").change();
   }, 200);
</script>

Open in new window

This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.