Enabling/disabling RadColorPicker in JavaScript

2 posts, 0 answers
  1. Andy
    Andy avatar
    11 posts
    Member since:
    Aug 2008

    Posted 10 Oct 2008 Link to this post

    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?
  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 13 Oct 2008 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top