I am having issues with a custom user control that only seems to be happening in IE6. The custom control contains a radcolorpicker and a radtextbox. When the page gets posted back, the textbox is supposed to have the hex value of the color picked in the color picker as its text. This works correctly in IE7 and FireFox, but in IE6 the control never gets updated. When I walk throught the code while debugging, in the OnPreRender event, the textbox is set to the correct value, but when the page renders, it has changed. Anybody have any suggestions or have you run across this before? The html for the user control is as follows:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucColorPicker.ascx.cs" Inherits="userControls_ucColorPicker" %> | |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> | |
<div style="width: 100%;"> | |
<div style="width: 410px; float: left"> | |
<asp:Label ID="Label2" runat="server" Text="Select a color:" CssClass="normalTextBold"></asp:Label> | |
</div> | |
<div> | |
<asp:Label ID="Label1" runat="server" Text="Or enter color code:" CssClass="normalTextBold"></asp:Label> | |
</div> | |
<div style="width: 410px; float: left"> | |
<telerik:RadColorPicker ID="rcpColor" runat="server" Preset="Default" AutoPostBack="True" | |
OnColorChanged="rcpColor_ColorChanged" PreviewColor="False"> | |
</telerik:RadColorPicker> | |
</div> | |
<telerik:RadTextBox ID="rtbxColor" runat="server" Height="16px" InvalidStyleDuration="100" | |
Skin="Outlook" Width="60px" EmptyMessage="#000000" OnTextChanged="rtbxColor_TextChanged"> | |
</telerik:RadTextBox> | |
<br /> | |
<asp:RegularExpressionValidator ID="revColor" runat="server" ErrorMessage="Format: # followed by 6 hex digits." | |
ControlToValidate="rtbxColor" ValidationExpression="^\#[0-9a-fA-f]{6}$"> | |
</asp:RegularExpressionValidator> | |
</div> | |
The c# code is as follows:
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Web; | |
using System.Web.UI; | |
using System.Web.UI.WebControls; | |
public partial class userControls_ucColorPicker : System.Web.UI.UserControl | |
{ | |
public string SelectedColor | |
{ | |
get | |
{ | |
return (string)ViewState["Color"]; | |
} | |
set | |
{ | |
ViewState["Color"] = value; | |
} | |
} | |
protected void Page_Load(object sender, EventArgs e) | |
{ | |
} | |
// ********************************* | |
// ***** rcpColor_ColorChanged ***** | |
// ********************************* | |
protected void rcpColor_ColorChanged(object sender, EventArgs e) | |
{ | |
SelectedColor = "#" + String.Format("{0:X2}", rcpColor.SelectedColor.R) + String.Format("{0:X2}", rcpColor.SelectedColor.G) + String.Format("{0:X2}", rcpColor.SelectedColor.B); | |
rtbxColor.Text = SelectedColor; | |
} | |
// ********************************* | |
// ***** rtbxColor_TextChanged ***** | |
// ********************************* | |
protected void rtbxColor_TextChanged(object sender, EventArgs e) | |
{ | |
SelectedColor = rtbxColor.Text; | |
} | |
// *********************** | |
// ***** OnPreRender ***** | |
// *********************** | |
protected override void OnPreRender(EventArgs e) | |
{ | |
rtbxColor.Text = SelectedColor; | |
} | |
} | |