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

RadColorPicker - Invalid Argument (JS Error)

1 Answer 48 Views
ColorPicker
This is a migrated thread and some comments may be shown as answers.
m
Top achievements
Rank 1
m asked on 04 Feb 2009, 12:52 PM
Hi,
I am getting a javascript error - 'Invalid Argument' when I try to select a color using RadColorPicker.
I have added following code in my aspx
-

 

<telerik:RadColorPicker ID="RadColorPicker1"

 

 

ShowIcon="true"

 

 

Preset="Standard"

 

 

ShowEmptyColor="false"

 

 

SelectedColor="#000000"

 

 

OnClientColorChange="ChangeColor" runat="server" />

I have follwoing script:

 

<

script language="javascript" type="text/javascript">

 

 

var ChangeColor = function(a,eventArgs) {

 

alert(a);

<%=

this.ClientID %>.Color = (eventArgs.get_color) ? eventArgs.get_color() : a.get_selectedColor();

 

};
</script >

I am suspecting this to be some version (may be RAD version / XML version / IE version) issue. 

On debugging I fpund that the issue is  in ScriptResource.axd  in the following function. error line marked in bold:

 

_createColorElement:function(_13,_14){

var _15=(this._selectedColor==_13.value)?"selectedcolor":"colorbox";

var li=document.createElement("li");

var _17=document.createElement("a");

_17.title=_13.title;

_17.href="javascript:void(0);";

_17.className=_15;

_17.style.background=_13.value; // HERE IS WHERE MY DEBUGGER STOPS

var _18=this._createSpanEl("",_13.value);

_18.style.width=_14+"px";

_18.style.height=_14+"px";

_17.appendChild(_18);

li.appendChild(_17);

return li;

}

 

 

 

Please guide.

Thanks and Regards,
Maitreyee

1 Answer, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 06 Feb 2009, 04:30 PM
Hello Maitreyee,
I tried to reproduce the problem you describe, but to no avail. Below is the code of my page:
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server"
        <asp:ScriptManager ID="ScritpManager1" runat="server"
        </asp:ScriptManager> 
        <telerik:RadColorPicker ID="RadColorPicker1" ShowIcon="true" Preset="Standard" ShowEmptyColor="false" 
            SelectedColor="#000000" OnClientColorChange="ChangeColor" runat="server" /> 
        <script language="javascript" type="text/javascript"
            var ChangeColor = function(a,eventArgs)  
            {  
                alert(a); 
                <%= this.ClientID %>.Color = (eventArgs.get_color) ? eventArgs.get_color() : a.get_selectedColor(); 
            };  
        </script > 
    </form> 
</body> 

I tested in both IE and FF with the latest version of the suite, as you have specified - version 2008.3 1314.

I actually did get an error - "__Page is not defined", but it was not connected to the code of the RadColorPicker, but rather to the following line:
<%= this.ClientID %>.Color 

In case you can send me a simple running project, demonstrating the problem, I will do my best to find what is causing it.

Regards,
Tsvetie
the Telerik team

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