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

RadColorPicker in Grid

1 Answer 93 Views
ColorPicker
This is a migrated thread and some comments may be shown as answers.
Alessio
Top achievements
Rank 1
Alessio asked on 27 Jan 2009, 11:12 AM
hi,
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()); }

Thank.

Alessio.




1 Answer, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 27 Jan 2009, 03:16 PM
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,
Svetlina
the Telerik team

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