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

IE6 is keeping old values across postbacks

1 Answer 33 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ben
Top achievements
Rank 1
Ben asked on 17 Nov 2008, 04:49 PM
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;  
    }  
}  
 

 

 

1 Answer, 1 is accepted

Sort by
0
Pavel
Telerik team
answered on 18 Nov 2008, 07:10 AM
Hi Ben,

Indeed the problem can be observed with the version of RadControls for Asp.Net Ajax you are using (Q1 2008 SP2 619). However I tested the scenario with our latest release (Q3 2008 1105) and everything seemed to work as expected. Please upgrade to the latest version and let us know if you need additional assistance.

Greetings,
Pavel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
Ben
Top achievements
Rank 1
Answers by
Pavel
Telerik team
Share this question
or