Exemplo n.º 1
0
    private void refreshModulePanel(Gamme gammeSelectionne)
    {
        downPanel.Controls.Clear();

        Button ajouterModuleButton = new Button();

        ajouterModuleButton.ID   = "ajouterModuleButton";
        ajouterModuleButton.Text = "Ajouter un nouveau module";
        ajouterModuleButton.Attributes["data-toggle"] = "modal";
        ajouterModuleButton.Attributes["data-target"] = "#myModal";
        ajouterModuleButton.CssClass = "btn btn-xs btn-primary";

        AjaxControlToolkit.ModalPopupExtender buttonModalPopup = new AjaxControlToolkit.ModalPopupExtender();
        buttonModalPopup.ID = "mpe";
        buttonModalPopup.TargetControlID = ajouterModuleButton.ID;
        buttonModalPopup.PopupControlID  = "ModalPanel";
        buttonModalPopup.OkControlID     = "OKButton";


        ModalTypeModuleDropDownList.DataSource      = moduleRepository.GetByGamme(gammeSelectionne);
        ModalTypeModuleDropDownList.DataTextField   = "Nom";
        ModalTypeModuleDropDownList.DataValueField  = "Id";
        ModalTypeModuleDropDownList.EnableViewState = true;
        ModalTypeModuleDropDownList.DataBind();

        foreach (ModuleCompose module in produitSelectionne.ModeleDeGamme.Modules)
        {
            if (module.Module.Type == "0")
            {
                Panel panelModule = new Panel();

                Label newModuleLabel = new Label();
                newModuleLabel.Text = module.Identification;
                panelModule.Controls.Add(newModuleLabel);

                ImageButton deleteButton = new ImageButton();
                deleteButton.ImageUrl = "Images/cancel-icon.png";
                deleteButton.Height   = 10;
                deleteButton.Width    = 10;
                deleteButton.ID       = module.Identification;
                deleteButton.Click   += new ImageClickEventHandler(this.ImgBtnDeleteModule_Click);
                panelModule.Controls.Add(deleteButton);
                downPanel.Controls.Add(panelModule);
            }
        }

        Button confirmProduit = new Button();

        confirmProduit.Text     = "Terminer";
        confirmProduit.CssClass = "btn btn-xs btn-primary";
        confirmProduit.Click   += new EventHandler(this.BtnConfirmProduct_Click);


        Panel pan = new Panel();

        pan.Controls.Add(ajouterModuleButton);
        pan.Controls.Add(buttonModalPopup);
        pan.Controls.Add(confirmProduit);
        downPanel.Controls.Add(pan);
    }