I have the following model which is wrapped in my view model i want to pass MaximumDaysAheadBookable property to datepicker function
public class SessionObject { public int MaximumNumberOfRooms { get; set; } public int MaximumNumberOfAdultsPerRoom { get; set; } public int MaximumNumberOfChildrenPerRoom { get; set; } public int MaximumDaysAheadBookable { get; set; } public int MaximumDaysBetweenCheckinCheckout { get; set; } } How do I access one of the above properties from Javascript.js file ? then pass it to datepicker function :
$('document').ready(function () { $("#Arrival").datepicker({ minDate: 0, maxDate:MaximumDaysAheadBookable , ////here i want to pass model value dateFormat: 'dd/mm/yy', showOn: "button", buttonImage: "img/ui_cal_icon.gif", buttonImageOnly: true, buttonText: "Select date", }); });
var maxDate = @Model.MaximumDaysAheadBookable;and then in the external file -maxDate: maxDate,