User-271186128 posted
Hi EssCee,
Im trying to set dates for this control via code behind. My current attempt (Add code to set dates) is having setdates to call a variable in code behind but i get a "circular error". The addDates
function allows me to add dates so not sure what im missing here?
Please refer to the following code to get the date variable in the code behind:
Code behind:
public DateTime setdates;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
setdates = DateTime.Now;
}
}
Code in the .aspx page: need to add the quotation marks
$("#btnAdd").click(function () {
var dates = $('#mdp-demo').multiDatesPicker('getDates');
$("#HiddenField1").val(dates);
//debugger;
// Add code to set dates
var setdates = '<%=this.setdates %>';
$('#mdp-demo').multiDatesPicker('addDates', setdates);
});
More details about how to use MultiDatesPicker please refer to the following link:
http://dubrox.github.io/Multiple-Dates-Picker-for-jQuery-UI/#method-getDates
Best regards,
Dillion