jquery - DatePicker in MVC4 -
i using @html.jqueryui().datepickerfor
helper method in mvc4 application. showing calender correctly @ first time not showing once form posted. can tell me missing in it?
i suspect using ajax submit form , in case of successful submission refreshing contents , date picker no longer bound input field. inside success callback of ajax request need rebind it:
success: function(data) { $('#some_id').html(data); $('#id_of_your_input_element').datepicker(); }
or if using ajax.beginform subscribe success event in ajaxoptions:
@using (ajax.beginform(new ajaxoptions { success = "success", updatetargetid = "someid" })) { ... }
and write success
callback:
function success(data) { $('#id_of_your_input_element').datepicker(); }