Color Palette inside Button Menu - Don't load value in page load.

  1. #1

    [CLOSED] Color Palette inside Button Menu - Don't load value in page load.

    First, sorry for the bad english.

    I'm using a color palette inside a button menu. This palette has a Ajax Event, who change a label text.
    This method work's fine when i select a color. But it's not working in the page load.

    The code:
    
                    <ext:Button Text="Selecione uma cor" Icon="Color" runat="server" ID="btnCor"  IsFormField="true" >
                        <Menu>
                            <ext:Menu ID="menuCor" runat="server" RenderToForm="true" >
                                <Items>
                                    <ext:Panel runat="server" ID="pnlCor" Border="false" Header="false">
                                    <Items>
                                        <ext:ColorPalette   runat="server" ID="campoCor"  PropertyName="Cor"  >
                                            <DirectEvents>  
                                                <Select OnEvent="AjaxColor_Changed" ></Select>    
                                            </DirectEvents>     
                                        </ext:ColorPalette>                                      
                                    </Items>
                                    </ext:Panel>
                                </Items>
                            </ext:Menu>
                        </Menu>                 
                    </ext:Button>
    				<ext:Label ID="campoCorSelecionada" AutoRender="true" runat="server" />
            protected void AjaxColor_Changed(object sender, DirectEventArgs e)
            {
                LoadColorLabel(campoCor.Value);
            }
            
            protected void LoadColorLabel(string cor )
            {
                if (!string.IsNullOrEmpty(cor))
                {
                    string tpl = "Selected color: #<span style='color:#{0}; font-weight:bold;' >{0}</span>";
                    campoCorSelecionada.Text = string.Format(tpl, cor);
                }
            }
    		
    		protected void Page_Load(object sender, EventArgs e)
    		{
    			
                if (!string.IsNullOrEmpty(color))
                {
                    campoCor.Value = color;
                }
                LoadColorLabel(color);
    		}
    The page_load don't show the label and not set the value of color palette. And the javascript show this error:
    Uncaught type error: Cannot call method 'child' of undefined
    Last edited by Srgio; Dec 12, 2012 at 3:33 PM.
  2. #2

    Solution

    Thanks for all atention.
    The solution: use <paleteName>.render() and <labelName>.render(); after set the values.

Similar Threads

  1. Load Ext:Gridpanel Conditionally on Page Load
    By kabirnig2405 in forum 1.x Help
    Replies: 0
    Last Post: Sep 02, 2011, 9:09 AM
  2. [CLOSED] Stop treepanel to load data on page load
    By inayath in forum 1.x Premium Help
    Replies: 1
    Last Post: Feb 11, 2011, 10:17 AM
  3. Replies: 3
    Last Post: Jun 28, 2010, 3:37 PM
  4. how to load data to grid panel in page load
    By andylaiyongsing in forum 1.x Help
    Replies: 1
    Last Post: Apr 16, 2010, 10:27 AM
  5. Replies: 13
    Last Post: Feb 24, 2010, 5:34 PM

Tags for this Thread

Posting Permissions