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

javascript to Enable rad date picker is not working in chrome and safari

5 Answers 458 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Esther Nirmala
Top achievements
Rank 1
Esther Nirmala asked on 24 May 2011, 10:15 AM
Hi,

    I have to disable rad datepicker if a checkbox is checked. if i uncheck the checkbox i have to enable the rad datepicker.. I am able to disable the date picker in all browsers. But i am not able to enable the same in firefox, chrome and safai.. it works in IE.  Is there any solution to avoid this?

var CheckBoxNoExpiration = document.getElementById('<%= CheckBoxNoExpiration.ClientID %>');
                   var DatePicker = $find('<%= RadExpiryDate.ClientID %>');
                   var MandatoryMark = document.getElementById('<%= MandatoryMark.ClientID %>');
                   if (CheckBoxNoExpiration != null) {
                       if (CheckBoxNoExpiration.checked) {
                           if (MandatoryMark != null)
                               MandatoryMark.style.display = 'none';
                           DatePicker.get_dateInput().disable();
                           DatePicker.get_dateInput.onclick = function() { return false; };
                           //onKeyDown = "javascript:return false;"
                           DatePicker._popupButton.disabled = true;
                           DatePicker._popupButton.onclick = function() { return false; };
                       }
                       else {
                           if (MandatoryMark != null)
                               MandatoryMark.style.display = 'inline';
                           DatePicker.get_dateInput().enable();
                           DatePicker._popupButton.disabled = false;
                           DatePicker._popupButton.onclick = function() { DatePicker.togglePopup(); return false; };
                       }
                   }

Thx
Esther

5 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 26 May 2011, 02:37 PM
Hi Esther,

Find attached a very simple application which demonstrates similar scenario and works correctly in each browsers. I hope it helps.

Regards,
Maria Ilieva
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Maria Ilieva
Telerik team
answered on 26 May 2011, 02:37 PM
Hi Esther,

Find attached a very simple application which demonstrates similar scenario and works correctly in each browsers. I hope it helps.

Regards,
Maria Ilieva
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Clifton
Top achievements
Rank 1
answered on 08 Nov 2011, 04:18 PM
Hi there, I have the same issue
I done
$find("<%= TxtRdpFromDate.ClientID %>").set_enabled(false);
 inside
  <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

to disable or enable the following control
<telerik:RadDatePicker ID="TxtRdpFromDate" runat="server">
                        </telerik:RadDatePicker>

When using IE it works but under chrome or firefox it doesn't I tried to change the find to look like your example
$find("TxtRdpFromDate").set_enabled(false);

Any Idea??
0
Shinu
Top achievements
Rank 2
answered on 09 Nov 2011, 11:47 AM
Hello Clifton,

I tried to reproduce the issue but no avail. Here is the sample code.
C#:
protected void Page_Load(object sender, EventArgs e)
 {
 CheckBox1.Attributes.Add("onclick","clickon();");
 }

JS:
<script type="text/javascript">
  function clickon()
   {
      var chk = document.getElementById("CheckBox1");
      var dtpcr = $find("<%=RadDatePicker1.ClientID %>");
      if (chk.checked == true)
      {
         dtpcr.set_enabled(false);
      }
       else
      {
         dtpcr.set_enabled(true);
      }
   }
</script>

Thanks,
Shinu.
0
Maria Ilieva
Telerik team
answered on 10 Nov 2011, 01:45 PM
Hi Clifton,

As we are not able to replicate the described issue on our side I would suggest you to open a regular support ticket and send us runnable version of your application which demonstrates the problematic behaviour. Thus we will be able to debug it locally and do our best to isolate the problem.

Kind regards,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Calendar
Asked by
Esther Nirmala
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Clifton
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or