Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it L'avatar di sersul
    Registrato dal
    Feb 2003
    Messaggi
    75

    [c#] Dinamically ImageButton in code behind

    Sto creando un ImageButton dinamicamente in questo modo:
    codice:
    protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack) {
                ImageButton ib = new ImageButton();
                ib.ID = "IBIDLJKK";
                ib.ImageUrl = "../../App_Themes/White/Images/button-delete.gif";
                ib.CommandName = "ib_Command";
                ib.Click +=new ImageClickEventHandler(ib_Click);
                Control c = FindControl("form1");
                c.Controls.Add(ib);
            }
        }
    ma l'evento ib_click non mi viene catturato.

    Qualche aiuto?

    Thanks

  2. #2
    Utente di HTML.it L'avatar di pietro09
    Registrato dal
    Jan 2002
    Messaggi
    10,116
    codice:
        protected void Page_Load(object sender, EventArgs e)
        {
            ImageButton ib = new ImageButton();
            ib.ID = "IBIDLJKK";
            ib.ImageUrl = "../../App_Themes/White/Images/button-delete.gif";
            ib.CommandName = "ib_Command";
            ib.Click += new ImageClickEventHandler(ImageButton_click);
            this.Form.Controls.Add(ib);
    
        }
    
        protected void ImageButton_click(object sender, ImageClickEventArgs e)
        {
            this.Response.Write(DateTime.Now);
        }
    Pietro

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.