Nov 17, 2011, 10:53 AM
[FormPanel] Buttons dinamically + Before script + User Control + Iterate over all FormPanel's of the window
Hello...
this is my second post regarding add buttons dinamically, but I think this issue is another thread.
I'm trying add the following "Before" script for a button created dinamically:
The script used is:
Does anyone know how can I solve this issue or iterate over all FormPanel's from the window?
this is my second post regarding add buttons dinamically, but I think this issue is another thread.
I'm trying add the following "Before" script for a button created dinamically:
btn = new Ext.Net.Button();
btn.DirectEvents.Click.Before = this.ButtonScriptBefore;
btn.Text = targetDH.NomeBotao;
//ajusta o id para que não haja problemas
btn.ID = targetDH.Id.ToString().Replace("-", string.Empty);
//Coloca o Id
btn.DirectEvents.Click.ExtraParams["targetId"] = targetDH.Id.ToString();
btn.DirectEvents.Click.Event += new ComponentDirectEvent.DirectEventHandler(this.btn_Click);
//Adiciona o botão ao painel de botões
btn.AddTo(pnlBotoes);
if (X.IsAjaxRequest)
{
btn.Render();
}
The script used is:
var forms = [#{FormPanelVerbaDisponivel},#{FormPanelAnexos},#{FormPanelComentarios}]; var valid = true; for(var i = 0;i < forms.length; i++) { var tempValid = forms[i].getForm().isValid(); if(!tempValid){valid = tempValid}} return valid;
If I put at the page, a similar button, it works fine:<ext:Button Text="Salvar" runat="server" ID="btnSalvar">
<DirectEvents>
<Click OnEvent="btnSalvar_DirectClick" Single="true" Before="var forms = [#{FormPanelVerbaDisponivel},#{FormPanelAnexos},#{FormPanelComentarios}]; var valid = true; for(var i = 0;i < forms.length; i++) { var tempValid = forms[i].getForm().isValid(); if(!tempValid){valid = tempValid}} return valid;">
</Click>
</DirectEvents>
</ext:Button>
But when I use the dinamically created button the "#{FormPanelVerbaDisponivel}", "#{FormPanelAnexos}" and "#{FormPanelComentarios}" variables are null values (they're server Id's for FormPanel's).Does anyone know how can I solve this issue or iterate over all FormPanel's from the window?
Last edited by marcoslimagon; Nov 17, 2011 at 10:56 AM.