ColorChanged EH not firing

9 posts, 0 answers
  1. Scott
    Scott avatar
    29 posts
    Member since:
    Nov 2007

    Posted 27 Dec 2007 Link to this post

    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?
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 28 Dec 2007 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Scott
    Scott avatar
    29 posts
    Member since:
    Nov 2007

    Posted 28 Dec 2007 Link to this post

    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.

  5. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 02 Jan 2008 Link to this post

    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
  6. Scott
    Scott avatar
    29 posts
    Member since:
    Nov 2007

    Posted 02 Jan 2008 Link to this post

    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
  7. Scott
    Scott avatar
    29 posts
    Member since:
    Nov 2007

    Posted 03 Jan 2008 Link to this post

    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.
  8. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 08 Jan 2008 Link to this post

    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
  9. Scott
    Scott avatar
    29 posts
    Member since:
    Nov 2007

    Posted 08 Jan 2008 Link to this post

    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...
  10. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 11 Jan 2008 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017