Buttons created dynamically don't appear

  1. #1

    Buttons created dynamically don't appear

    Hi, i'm trying to create buttons on code behind, all is well, but when i run the code, the buttons are not displayed

    <ext:Window ID="windowSucesoEnSistema" runat="server" 
            Width="600" 
            BodyStyle="height: auto;" 
            Resizable="false" 
            Modal="true" 
            AutoRender="false">
     <Items>
                <ext:FormPanel  runat="server" ID="formPanelSS"  Width="600" BodyPadding="10" DefaultAnchor="100%" >
                    <Items>
    <ext:Container runat="server" ID="ContainerBotonesArchivosSS" Layout="ColumnLayout" />
    </Items>
                    <Listeners>
                        <ValidityChange Handler="#{btnAceptarTicketSuceso}.setDisabled(!valid);" />
                    </Listeners>
                </ext:FormPanel>
            </Items>
            <Buttons>
                <ext:Button ID="btnImprimeTicket1" runat="server" OnClientClick="window.open('/ImpresionTicket.aspx')" Icon="Printer" Text="Imprimir"></ext:Button>
                <ext:Button ID="btnEnviaTicket1" runat="server" OnDirectClick="btnEnviaTicket_DirectClick" Icon="Email" Text="Enviar por correo"></ext:Button>
                <ext:Button ID="btnCerrarSucesoSistema" runat="server" Text="Cerrar" Icon="StopBlue" AutoPostBack="false" Hidden="true" OnDirectClick="Close_Edition_Of_Ticket">
                </ext:Button>
                <ext:Button ID="btnGuardarSucesoSistema" runat="server" Text="Guardar" Icon="Disk" AutoPostBack="false" Hidden="true" OnDirectClick="Update_Ticket" Visible="false">
                </ext:Button>
            </Buttons>
        </ext:Window>
    on code behind

    private void MuestraTicket()
        {
            wsSSIP.Ticket ticketR = (wsSSIP.Ticket)Session["TicketActualRev"];
            
            List<string> archivos = ws.DameArchivosTicket(ticketR.ID_Ticket).Cast<string>().ToList();
            int i = 0;
            foreach (string archivo in archivos)
            {
                Session.Add("filename" + i.ToString(), archivo);
                string extension = archivo.Substring(archivo.LastIndexOf("."));
                if (extension == "zip" || extension == "rar" || extension == "msg")
                {
                    Session.Add("path" + i.ToString(), "Documentos/" + archivo);
                }
                Ext.Net.Button boton = new Ext.Net.Button()
                {
                    ColumnWidth = 0.2,
                    Text = "Muestra archivo " + i.ToString(),
                    Icon = Icon.Attach,
                    ID = archivo                
                };
               ContainerBotonesArchivosSS.Items.Add(boton);
            }
    windowSucesoEnSistema.Show();
    }

    *the foreach it's ok the ws returns the strings that i expect
    Last edited by Prybe; Aug 22, 2014 at 7:13 PM. Reason: bad redaction
  2. #2
    I was unable to get your code sample working. Unfortunately, the Ext.NET support team will not be able to provide assistance with this request.
    Geoffrey McGill
    Founder
  3. #3

    ok a working sample

    ?? i suppose that i don't have to include all functionality because only import this part of the code, assuming the list it's fill manually, and the events of the buttons are ok (deleted lines)

    <ext:Window ID="windowSucesoEnSistema" runat="server"
            Width="600"
            BodyStyle="height: auto;"
            Resizable="false"
            Modal="true"
            AutoRender="false">
           <Items>
                <ext:FormPanel  runat="server" ID="formPanelSS"  Width="600" BodyPadding="10" DefaultAnchor="100%" >
                    <Items>
                        <ext:Container runat="server" ID="ContainerBotonesArchivosSS" Layout="ColumnLayout" />
                    </Items>
                </ext:FormPanel>
            </Items>
    
        </ext:Window>
    
    
    
    private void MuestraTicket()
    {
            
             
            List<string> archivos = new List<string>();//ws.DameArchivosTicket(ticketR.ID_Ticket).Cast<string>().ToList();
            archivos.Add("arch1.jpg");
            archivos.Add("otro.png");
            archivos.Add("otro2.zip");
            archivos.Add("blablabla.rar");
            int i = 0;
            foreach (string archivo in archivos)
            {
                string extension = archivo.Substring(archivo.LastIndexOf("."));
                Ext.Net.Button boton = new Ext.Net.Button()
                {
                    ColumnWidth = 0.2,
                    Text = "Muestra archivo " + i.ToString(),
                    Icon = Icon.Attach,
                    ID = archivo                
                };
               ContainerBotonesArchivosSS.Items.Add(boton);
            }
            windowSucesoEnSistema.Show();
    }
  4. #4
    I took another look at your sample, and I still don't know how to get it working.

    Please review the following link and Forum Guidelines before posting again:

    http://forums.ext.net/showthread.php...ation-Required
    Geoffrey McGill
    Founder

Similar Threads

  1. [CLOSED] CellCommand in dynamically created grid.
    By drizzie in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Aug 07, 2014, 4:52 PM
  2. how to set dynamically created treepanel width
    By antoreegan in forum 2.x Help
    Replies: 0
    Last Post: Jun 27, 2014, 11:42 AM
  3. Replies: 3
    Last Post: May 29, 2013, 3:49 AM
  4. Replies: 0
    Last Post: Sep 06, 2011, 6:33 PM
  5. Replies: 0
    Last Post: Sep 04, 2009, 1:07 AM

Tags for this Thread

Posting Permissions