I'm trying to use the following syntax to pass a variable from my ascx.cs file to my javascript :
in the ascx.cs :
protected string DateFinMax = WebConfigurationManager.AppSettings["DateFinMax"].ToString();
in the javascript :
$(function () {
$(".datepickerValidTo").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'dd/mm/yy',
minDate : 0,
maxDate: <%= DateFinMax %>,
showOn: 'both',
buttonImage: '../css/smoothness/images/calendar.gif',
buttonImageOnly: false
}, $.datepicker.regional['fr']);
});
The value of the variable in the code behind is good however I can't seem to pass it to my js file. I've tried to put simple and double quote aswell but nothing worked. The js file is called as follow at the end of my ascx file :
<script src ="js/datepicker.js"></script>
Any help would be appreciated. Thanks