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

ColorPicker JS error inside another Rad/Ajax control

2 Answers 51 Views
ColorPicker
This is a migrated thread and some comments may be shown as answers.
Mazdak
Top achievements
Rank 1
Mazdak asked on 22 Dec 2010, 03:19 PM
I got this JS error when I put ColorPicker inside another AJAX control:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; HPNTDF; .NET4.0C; .NET4.0E)
Timestamp: Wed, 22 Dec 2010 14:14:10 UTC

Message: Invalid argument.
Line: 4146
Char: 24
Code: 0
URI: http://localhost:53359/wisdom/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d4.1.40412.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3aacfc7575-cdee-46af-964f-5d85d9cdcf92%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2010.3.1215.40%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3a8c7a5421-4dd4-41ca-a3e5-203852b3dd8e%3a16e4e7cd%3a874f8ea2%3af7645509%3a24ee1bba%3af46195d3%3a19620875%3a490a9d4e%3abd8f85e4%3aa44b89c4%3a1e771326%3af9b9258%3bAjaxControlToolkit%2c+Version%3d4.1.40412.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3aacfc7575-cdee-46af-964f-5d85d9cdcf92%3a923aa3cc%3a853c2e0b%3a46f97eb1%3a782b16ab%3a535785ef%3af48dface%3a50114f04%3a29340eb0%3a8a480787

 


The ColorPicker works fine outside the AJAX control, here is an sample which gives this error:

<

 

 

asp:TextBox ID="DateTextBox" runat="server" Width="80" autocomplete="off" /><br /><br />

 

 

 

<asp:Panel ID="Panel1" runat="server" CssClass="popupControl">

 

 

 

<table style="width:310px;">

 

 

 

<tr>

 

 

 

<td style="white-space:nowrap;width:200px;vertical-align:top;">

 

Header Colour:

 

 

</td>

 

 

 

<td>

 

 

 

<telerik:RadColorPicker runat="server" ID="RadColorHeader" PaletteModes="All"

 

 

 

SelectedColor="98, 108, 137">

 

 

 

</telerik:RadColorPicker>

 

 

 

</td>

 

 

 

</tr>

 

 

 

</table>

 

 

 

 

</asp:Panel>

 

 

 

<ajaxToolkit:PopupControlExtender ID="PopupControlExtender1" runat="server"

 

 

 

TargetControlID="DateTextBox"

 

 

 

PopupControlID="Panel1"

 

 

 

Position="Right" />

 

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetie
Telerik team
answered on 23 Dec 2010, 02:30 PM
Hello Mazdak,
I was able to quickly reproduce the problem you describe, based on the provided information and code. The problem manifests, when the color picker is initialized in an invisible parent element (an element with "display:none;" style setting). We will fix it for Q3 2010 SP2. For the time being, you can use the following workaround:
<script type="text/javascript">
Telerik.Web.UI.RadColorPicker.prototype._oldinitializeFields = Telerik.Web.UI.RadColorPicker.prototype._initializeFields;
    Telerik.Web.UI.RadColorPicker.prototype._initializeFields = function()
    {
        this._showIcon = true;
        this._oldinitializeFields();
        this._showIcon = false;
    };
</script>

As you are not using a Telerik control to hide/show the color picker, you will have to call its repaint method manually as soon as the PopupControlExtender shows the "Panel1" panel. The controls from the RadControls for ASP.NET AJAX suite call this method in such cases internally.

Kind regards,
Tsvetie
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Mazdak
Top achievements
Rank 1
answered on 24 Dec 2010, 11:17 AM
Thanks a lot, the patch solve my problem in both threads.
Tags
ColorPicker
Asked by
Mazdak
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Mazdak
Top achievements
Rank 1
Share this question
or