Dec 11, 2012, 9:53 AM
[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:
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 Sérgio; Dec 12, 2012 at 3:33 PM.