RadColorPicker in Grid

2 posts, 0 answers
  1. Alessio
    Alessio avatar
    9 posts
    Member since:
    Nov 2008

    Posted 27 Jan 2009 Link to this post

    In my project i have a grid, inside it contains two template columns, one with a checkBox and one with a RadColorPicker.

    How can I take value to RadColorPicker on fire (to clientside) checkBox's onclick in the same row?

    This is the function that i use, cpObj is correctly found  but alert return "nothing" value:

    function ShowColor(ColorPickerClientID){
    var cpObj = document.getElementById(cpClientID);                         
            alert(cpObj.get_selectedColor()); }



  2. Svetlina Anati
    Svetlina Anati avatar
    2795 posts

    Posted 27 Jan 2009 Link to this post

    Hello Alessio,

    When you use the getElementById or $get methods you obtain a reference to the HTML element which represents the control and that is why an error occurs. In order to use the client-side API you should reference the client object which represents the control and this should be done by using the method $find. This being said, you should modify your code in the following manner:

    function ShowColor(ColorPickerClientID){  
        var cpObj = $find(cpClientID);                           
            alert(cpObj.get_selectedColor()); }  

    Sincerely yours,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top