1

i'm using a jquery datepicker and i'm facing the problem that when a postback is made the the datepicker disappears. I've tryed to reinitialize the datepicker on page load. Please advice, thanks in advance. I tryed so:

$(document).ready(function () {
pageLoad(); 
    SetValues();   
});
function pageLoad() {
        $("#calendar").datepicker({ dateFormat: 'mm/dd/yyyy' });
   } 
user2483797
  • 169
  • 1
  • 5
  • 13

2 Answers2

1
<script type="text/javascript" language="javascript">
    $(function() {
        $("#calendar").datepicker({ dateFormat: 'mm/dd/yyyy' });
    }); ;

    function pageLoad(sender, args) {
        if (args.get_isPartialLoad()) {
            $("#calendar").datepicker({ dateFormat: 'mm/dd/yyyy' });
        }
    };

</script>
CurseStacker
  • 1,079
  • 8
  • 19
0

This is correct logic.After postback you get new html with not initialize datepicker.Initialize date picker on page load is correct.

vborutenko
  • 4,323
  • 5
  • 28
  • 48