[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 no 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 boto ao painel de botes
    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 11:56 AM.

Similar Threads

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

Tags for this Thread

Posting Permissions