Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem adding button on the fly, with event handler
Message
De
31/08/2004 03:18:43
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires Web
Titre:
Problem adding button on the fly, with event handler
Divers
Thread ID:
00937907
Message ID:
00937907
Vues:
41
I've got some code on a ASP.NET webform, and I'm adding text and controls to a label at runtime.
Button1 = new Button();
Button1.Text = "Remove";

Button1.ID = i.ToString();
Button1.Click += new EventHandler(RemoveButton_Clicked);

lblGrid.Controls.Add( Button1 );
But when this runs, and the button is clicked, "RemoveButton_Clicked" isn't called. Instead it acts as if one of the other static buttons (with its own event handler) on the page was clicked.

Why? How do I fix that?
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform