[FormPanel] Buttons dinamically + Before script + User Control + Iterate over all FormPanel's of the window

  1. #1

    [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:

    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.

Similar Threads

  1. [CLOSED] [RAZOR] Iterate over controls in FormPanel
    By gets_gui in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: May 09, 2012, 2:20 PM
  2. [FormPanel] Buttons added dinamically
    By marcoslimagon in forum 1.x Help
    Replies: 17
    Last Post: Nov 17, 2011, 1:01 PM
  3. Replies: 7
    Last Post: Oct 28, 2011, 4:25 PM
  4. Replies: 3
    Last Post: Oct 12, 2011, 11:31 AM
  5. Property, user control and FormPanel
    By alainfo in forum 1.x Help
    Replies: 2
    Last Post: Jul 23, 2009, 11:02 AM

Tags for this Thread

Posting Permissions