I Have code like this :
<script type="text/javascript">
var some_date_range = ['20-10-2017','24-10-2017','27-10-2017','28-10-2017','25-10-2017'];
$('#daterange').daterangepicker({
isInvalidDate: function (date) {
for (var ii = 0; ii < some_date_range.length; ii++) {
if (date.format('DD-MM-YYYY') == some_date_range[ii]) {
return true;
}
}
}
})
</script>
I want block custom date in date range picker, and usually i put variable into javascript and code worked, how if i set variable date from code behind using textbox or label in ASP.Net .
please your advice
This code will disable custom dates in date range picker.
var naArray = ["20170822", "20170823", "20170824", "20170825"];
function isDateAvailable(date){
return naArray.indexOf(date.format('YYYYMMDD')) > -1;
}
$('input[name="daterange"]').daterangepicker({
isInvalidDate: isDateAvailable
});
好的...目前尚不清楚您想要什么,但听起来您只是想知道如何使用ASP设置javascript数组变量,在这种情况下,您只需编写:
var some_date_range = [<%= name_of_your_array_variable_from_asp %>];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.