I was using the colorpicker as per ajaxtoolkit site directives in my project.
but still I was getting one javascript error called _colorRegex undefined.
After searching on google I found below javascript code. Put this code after your ColorPickerExtender control
<asp:ColorPickerExtender ID="buttonCPE" runat="server" TargetControlID="txtColorCode" PopupButtonID="Image1" SampleControlID="Sample1" SelectedColor="" />
<script type="text/javascript">
//This code must be placed below the ScriptManager, otherwise the "Sys" cannot be used because it is undefined.
Sys.Application.add_init(function() {
// Store the color validation Regex in a "static" object off of
// AjaxControlToolkit.ColorPickerBehavior. If this _colorRegex object hasn't been
// created yet, initialize it for the first time.
if (!Sys.Extended.UI.ColorPickerBehavior._colorRegex) {
Sys.Extended.UI.ColorPickerBehavior._colorRegex = new RegExp('^[A-Fa-f0-9]{6}$');
}
});
</script>
Hope this would be helpful to you.
but still I was getting one javascript error called _colorRegex undefined.
After searching on google I found below javascript code. Put this code after your ColorPickerExtender control
<asp:ColorPickerExtender ID="buttonCPE" runat="server" TargetControlID="txtColorCode" PopupButtonID="Image1" SampleControlID="Sample1" SelectedColor="" />
<script type="text/javascript">
//This code must be placed below the ScriptManager, otherwise the "Sys" cannot be used because it is undefined.
Sys.Application.add_init(function() {
// Store the color validation Regex in a "static" object off of
// AjaxControlToolkit.ColorPickerBehavior. If this _colorRegex object hasn't been
// created yet, initialize it for the first time.
if (!Sys.Extended.UI.ColorPickerBehavior._colorRegex) {
Sys.Extended.UI.ColorPickerBehavior._colorRegex = new RegExp('^[A-Fa-f0-9]{6}$');
}
});
</script>
Hope this would be helpful to you.
No comments:
Post a Comment