Im using JSColor as colorpicker for my site, I had few issues with losing its instance after postback because of Update Panel but found solution for that in other question:
private void RegisterClientStartupScript(string scriptKey, string scriptText)
{
ScriptManager sManager = ScriptManager.GetCurrent(this.Page);
if (sManager != null && sManager.IsInAsyncPostBack)
{
//if a MS AJAX request, use the Scriptmanager class
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), scriptKey, scriptText, true);
}
else
{
//if a standard postback, use the standard ClientScript method
scriptText = string.Concat("Sys.Application.add_load(function(){", scriptText, "});");
this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), scriptKey, scriptText, true);
}
and using it in page_load like this fixed the problem:
RegisterClientStartupScript("some", "jscolor.init();");
Now I got it to work perfectly in Firefox but in Chrome it doesn’t even open when I press button, here is how it’s set up in markup:
<script type="text/javascript" src="jscolor/jscolor.js"></script>
in body:
<asp:TextBox ID="txtButtonTextColorSample" runat="server" Width="30px"></asp:TextBox>
<asp:TextBox ID="txtButtonTextColor" runat="server" OnTextChanged="txtButtonTextColor_TextChanged"></asp:TextBox>
<input type="button" id="fontCPicker" value="Pick" class="color {valueElement:'txtButtonTextColor',styleElement:'txtButtonTextColorSample',hash:true,required:false}" />
<input type="button" onclick=" doPostBackAsync('<%= txtButtonTextColor.ClientID %>', 'OnTextChanged');" value="Apply" />
It should show when button “fontCPicker” but nothing happens, I don’t see any errors in Chrome console but I’m not sure if it’s really debugging or not because I don’t use Chrome often.
Something was indeed wrong with lot of options that I’ve put in class attribute, so I replaced it with only basic options.