urgent RadDatePicker.SetMinDate(date) issue

2 posts, 0 answers
  1. Benjamin
    Benjamin avatar
    11 posts
    Member since:
    Oct 2007

    Posted 06 Jan 2010 Link to this post

    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?
  2. Radoslav
    Admin
    Radoslav avatar
    1566 posts

    Posted 07 Jan 2010 Link to this post

    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.
Back to Top