I am working with a JQuery UI DatePicker, and want the user to click an available date, when the date is clicked an event to be triggered and pass the date to a model, so my controller can get information back from the database.
my view looks like this right now, but I do not know what I need to do from here.
@model WebSite.DataModel.Booking
<script>
$(function () {
$("#datepicker").datepicker({ dateFormat: "dd-mm-yy" }).val();
});
@using (Html.BeginForm())
{
<div class="editor-field left" id="datepicker">
@Html.HiddenFor(model => model.SessionDate)
@Html.ValidationMessageFor(model => model.SessionDate)
</div>
<div class="col-md-10">
<input type="submit" value="Search Available Slots" class="btn btn-default left" />
</div>
}
I have had a look around on the net, but cant find anything that would trigger an event to pass the value from the @Html.HiddenFor based on the datepicker click event.
Any and all help very much appreciated.
Thanks