This is a migrated thread and some comments may be shown as answers.

urgent RadDatePicker.SetMinDate(date) issue

1 Answer 102 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Benjamin
Top achievements
Rank 1
Benjamin asked on 06 Jan 2010, 06:44 PM
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?

1 Answer, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 07 Jan 2010, 11:26 AM
Hi Benjamin,

Are you using RadControls for ASP.NET AJAX or the old version  RadControls for ASP.NET? Because in the RadControls for ASP.NET AJAX the function for setting mindate is set_minDate() not  SetMinDate(). You could check this documentation topic for more information:

http://www.telerik.com/help/aspnet-ajax/calendar_overviewmigrating.html

Also,  if after changing SetMinDate() to set_minDate() the issue persists , please open a formal support ticket and send us a simple project that could be used for reproducing the problem or share your Toolbar and DatePicker declaration.

I hope this helps.

All the best,
Radoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Calendar
Asked by
Benjamin
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Share this question
or