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

Enabling/disabling RadColorPicker in JavaScript

1 Answer 93 Views
ColorPicker
This is a migrated thread and some comments may be shown as answers.
Andy
Top achievements
Rank 1
Andy asked on 10 Oct 2008, 11:49 AM
Hi All!

I have a CheckBox, which must enable/disable RadColorPicker on client.

<asp:CheckBox ID="CheckBoxCreateDefaultPage" runat="server" Checked="true" onclick="CheckCreateDefaultPage(this)" /> 
<telerik:RadColorPicker ID="RadColorPicker1" runat="server" ShowIcon="true" ShowEmptyColor="false" /> 

and JavaScriptFunction:

            function CheckCreateDefaultPage(sender) {  
                var state = sender.checked;  
                var colorPicker = $find("<%= RadColorPicker1.ClientID %>");  
                colorPicker.set_enabled(!state);  
            }  
 

But I dont get any changes on RadColorPicker enabling.

What I forget? Or what wrong I do?

1 Answer, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 13 Oct 2008, 12:41 PM
Hello Andy,

Thank you for reportng this problem, I was able to reproduce it. We will do our best to fix it for our next release which is sheduled for next week but I cannot ensure you that we will succeed because there is very little time left and there are a lot of tasks with a higher priority set.

For the time being I suggestto use the following workaround:

 
        <script type="text/javascript">  
          function CheckCreateDefaultPage(sender)   
          {  
             
                var state = sender.checked;   
                var colorPicker = $find("<%= RadColorPicker1.ClientID %>");     
                colorPicker.set_enabled(!state);   
                ToggleEnabled()  
          }     
          function ToggleEnabled()  
          {  
             var colorPicker = $find("<%= RadColorPicker1.ClientID %>");     
             if (colorPicker._enabled)  
             {  
                colorPicker._disposeHandlers();  
                Sys.UI.DomElement.addCssClass( $get("<%= RadColorPicker1.ClientID %>"),"cpDisabled");   
                colorPicker._enabled = false;    
             }  
             else  
             {   
               colorPicker._initializeEventHandlers();  
               Sys.UI.DomElement.removeCssClass( $get("<%= RadColorPicker1.ClientID %>"),"cpDisabled");     
               colorPicker._enabled = true;  
             }       
          }  
        </script> 
 
        <asp:CheckBox ID="CheckBoxCreateDefaultPage" runat="server" Checked="true" onclick="CheckCreateDefaultPage(this)" /> 
        <telerik:RadColorPicker ID="RadColorPicker1" runat="server" ShowIcon="true" ShowEmptyColor="false" 
            Enabled="true" /> 

For your convenience I also attached my test page. I also updated your account with 500 Telerik points for your cooperation.


All the best,
Svetlina
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ColorPicker
Asked by
Andy
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Share this question
or