I have this in view:
$('#datepicker').datepicker({
onSelect: function (date, inst){
$(this).parent('form').submit();
}
});
<form method="post" name="datepickerForm">
<div id="datepicker"></div>
</form>
Date Posted: @ViewBag.PostedDate
in the controller, I have:
public ActionResult Index(int? datepickerForm) {
if(datepickerForm.HasValue) // this is always null
ViewBag.PostedDate = datepickerForm.Value;
}
I ended up using both
divfor display andinput textboxfor posting date back.in the controller, I have: