Information générale
Titre:
Linkbutton command does not fire
Hello,
I'm building an ASP.NET (1.1) application. On a page I have a PlaceHolder object. In the code behind file I determine the kind of object to add to the PlaceHolder. Sometimes a LinkButton is added like this:
LinkButton myLinkButton = new LinkButton();
myLinkButton.Text = "Some text";
myLinkButton.CommandArgument = "SomeArgument";
myLinkButton.Command += new CommandEventHandler(MyCommandHandler);
myPlaceHolder.Controls.Add(myLinkButton);
When I run the app I get a linkButton on my form, but when I click on it MyCommandHandler is never executed. MyCommandHandler lokks like this:
protected void MyCommandHandler(Object sender, CommandEventArgs e)
{
DoSomething();
}
I also tried the Click event, but with the same result. What's wrong with my code?
TIA,
Martin
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement