我有以下模型,它包含在我想要的视图模型中
将MaximumDaysAheadBookable
属性传递给datepicker函数
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; }
}
如何从Javascript.js文件访问上述属性之一?然后将它传递给datepicker函数:
$('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",
});
});
答案 0 :(得分:0)
在外部js文件中,您需要将数据作为参数传递。