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

ColorChanged EH not firing

8 Answers 146 Views
ColorPicker
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 27 Dec 2007, 08:15 PM
i setup my radcolorpicker control here:

            ctrlColorPicker1 = new RadColorPicker(); 
            ctrlColorPicker1.ID = "radColorPicker1"
            ctrlColorPicker1.Preset = ColorPreset.Standard; 
            ctrlColorPicker1.SelectedColor = Color.Blue; 
            ctrlColorPicker1.ShowIcon = true
            ctrlColorPicker1.AutoPostBack = true
            ctrlColorPicker1.ColorChanged += new EventHandler(ctrlColorPicker1_ColorChanged); 
            Controls.Add(ctrlColorPicker1); 

my event handler definition is as follows:

        private void ctrlColorPicker1_ColorChanged(object sender, EventArgs e) 
        {} 

i follow the flow in my debugger, and the event handler is not called when i select a new color from the radcolorpicker.

any ideas?

8 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 28 Dec 2007, 10:57 AM
Hello Scott,

I am not sure what the problem is because you haven't sent your full code. That is why I made a small sample based on your code excerpt (I've had to modify it a little bit) and as you can see from the attached movie, everything is working as expected.

I also attached the test page that I used - can you please check it and let me know if I am missing something?




Best wishes,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Scott
Top achievements
Rank 1
answered on 28 Dec 2007, 03:54 PM
This is my full code:

        private Label label1; 
        private RadColorPicker ctrlColorPicker1; 
         
        public RadControlPrometheus() 
        { 
            this.ExportMode = WebPartExportMode.All; 
        } 
 
        protected override void CreateChildControls() 
        { 
 
            label1 = new Label(); 
            label1.ForeColor = Color.Black; 
            label1.Text = ""
            Controls.Add(label1); 
 
            ctrlColorPicker1 = new RadColorPicker(); 
            ctrlColorPicker1.ID = "radColorPicker1"
            ctrlColorPicker1.Preset = ColorPreset.Standard; 
            ctrlColorPicker1.SelectedColor = Color.Blue; 
            ctrlColorPicker1.ShowIcon = true; // this makes the color picker show as an icon until selected 
            ctrlColorPicker1.AutoPostBack = true; // must be set for event handlers to fire 
            ctrlColorPicker1.ColorChanged += new EventHandler(ctrlColorPicker1_ColorChanged); 
            Controls.Add(ctrlColorPicker1); 
 
 
        } 
 
        private void ctrlColorPicker1_ColorChanged(object sender, EventArgs e) 
        { 
 
            label1.Text = "Color Changed at " + DateTime.Today; 
 
        } 

I simplified my code to resemble your example, except utilizing a MOSS web part.  Debugging this code, the event fires, but the label is never updating.  I can't explain it.

0
Tervel
Telerik team
answered on 02 Jan 2008, 04:29 PM
Hello Scott,

Your code seems correct, and we were not able to find any flaws. Also, as you write yourself, the RadColorPicker event does fire (as it fires in the example provided by us).

If the label does not get udpated, the reason for this is outside of the scope of the code. We are not able to help further, as the RadColorPicker does work properly.

Greetings,
Tervel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Scott
Top achievements
Rank 1
answered on 02 Jan 2008, 06:33 PM
Tervel,

It looks like the trouble goes a little deeper than just the label not reflecting a text change.  The event handler fires the first time I change the color, but no subsequent times.  I event went as far as removing all code from within the event handler function.  Still, the page only posted back on the first color change.

Scott
0
Scott
Top achievements
Rank 1
answered on 03 Jan 2008, 03:52 PM
Further investigation:

I replaced all RadColorPickers in my solution with DropDownList controls filled with ListItems representing Colors.  Everything works.

I don't know what it is about the RadColorPicker in my MOSS WebPart's CreateChildControls method, but it seems to stop responding during the 1st event fire.  Hopefully I am not the only one having this issue, and it will be resolved in a future build of the prometheus control line.
0
Tsvetie
Telerik team
answered on 08 Jan 2008, 09:47 AM
Hi Scott,
I tried to reproduce the problem you describe, but to no avail, the event fires every time I change the color - please find my test project attached. If you send us a simple running project, demonstrating the described behavior, we will do our best to find what is causing it. 

All the best,
Tsvetie
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Scott
Top achievements
Rank 1
answered on 08 Jan 2008, 02:09 PM
to accurately replicate the issue i am referencing, you will need to create a System.Web.UI.WebControls.WebParts.WebPart project, override the createchildcontrols method with code for your radcolorpicker, and then deploy to a MOSS environment.  within the site collection you added the solution to, edit/add web part to a page.  the firing of the radcolorpicker does not work.

hope this helps shed some light...
0
Tsvetie
Telerik team
answered on 11 Jan 2008, 06:03 PM
Hi Scott,
In order to speed up the process of finding the cause for the problem, I would like to ask you to send us your code. Unfortunately, so far we have not been able to reproduce it on our side.

Kind regards,
Tsvetie
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
ColorPicker
Asked by
Scott
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Scott
Top achievements
Rank 1
Tervel
Telerik team
Tsvetie
Telerik team
Share this question
or