Hi,
I have a RAD Toolbar where a DatePicker resides along with other RAD controls. I want to set the min and max date of the DatePicker from by changing selections of a DropDownList also in the toolbar. For some reason the client side script only works partially.
The script is on the markup of the page where the Toolbar is sitting:
function ReSetDatePickerRange(nDays)
{
var datePicker = ctl00_dpDatePicker;
var date = datePicker.GetMaxDate();
var nTransDays = parseInt(nDays);
var minDate = new Date(date.getFullYear(), date.getMonth(), date.getDay());
minDate.setDate(date.getDate() - nTransDays);
datePicker.SetMinDate(minDate);
alert('test');
if(datePicker.GetMinDate() > datePicker.GetDate())
{
datePicker.SetDate(datePicker.GetMinDate());
datePicker.SetInputDate(datePicker.GetMinDate());
}
}
I can access the datePicker and retrieve the dates using the GetMaxDate() and GetMinDate() but when I try to set them it just fails and breaking the code (the alert('test'); message is not popping up). I have even tried to register this client script in code behind with the same result. I thought maybe the date is not valid but the minDate is in the format:
Wed Jan 06 2010 00:00:00 GMT+0000 (GMT Standard Time
Is there any reason for this?
I have a RAD Toolbar where a DatePicker resides along with other RAD controls. I want to set the min and max date of the DatePicker from by changing selections of a DropDownList also in the toolbar. For some reason the client side script only works partially.
The script is on the markup of the page where the Toolbar is sitting:
function ReSetDatePickerRange(nDays)
{
var datePicker = ctl00_dpDatePicker;
var date = datePicker.GetMaxDate();
var nTransDays = parseInt(nDays);
var minDate = new Date(date.getFullYear(), date.getMonth(), date.getDay());
minDate.setDate(date.getDate() - nTransDays);
datePicker.SetMinDate(minDate);
alert('test');
if(datePicker.GetMinDate() > datePicker.GetDate())
{
datePicker.SetDate(datePicker.GetMinDate());
datePicker.SetInputDate(datePicker.GetMinDate());
}
}
I can access the datePicker and retrieve the dates using the GetMaxDate() and GetMinDate() but when I try to set them it just fails and breaking the code (the alert('test'); message is not popping up). I have even tried to register this client script in code behind with the same result. I thought maybe the date is not valid but the minDate is in the format:
Wed Jan 06 2010 00:00:00 GMT+0000 (GMT Standard Time
Is there any reason for this?