Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it L'avatar di Franz78
    Registrato dal
    Sep 2004
    Messaggi
    730

    ASp.NET 2.0 Evento run time

    NN riesco a far fare una semplice azione ad un button creato a run.time...dove sbaglio?
    Grazie per le sempre gentili risposte.


    codice:
        
            Button btn = new Button();
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                    btn.Text = "test";
                    this.btn.Click += new System.EventHandler(this.MyButton_Click);
                    PlaceHolder1.Controls.Add(btn);
    
                }
            }       
    
            private void MyButton_Click(object sender, System.EventArgs e)
            {
                Response.Write("ciao");
    
            }

  2. #2
    Utente di HTML.it L'avatar di Franz78
    Registrato dal
    Sep 2004
    Messaggi
    730
    come nn detto....

    ecco qua..
    codice:
     protected void Page_Load(object sender, EventArgs e)
            {
                    btn.Text = "test";
                    this.btn.Click += new System.EventHandler(this.MyButton_Click);
                    PlaceHolder1.Controls.Add(btn);
    
            }       
    
            private void MyButton_Click(object sender, System.EventArgs e)
            {
                Response.Write("ciao");
    
            }

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 © 2026 vBulletin Solutions, Inc. All rights reserved.