I'm trying to create ImageButtons dynamically. Something like this:
So far so good. Now I want to create a function to handle click events, say, myClick(). Something like:
So... how do I link the two together? I've tried:
... but it doesn't seem to work. Any ideas?
Code:
ImageButton myButton = new ImageButton();
myButton.ImageUrl = "images/arrow_collapse.gif";
.
.
.
myContainer.Controls.Add (myButton);
So far so good. Now I want to create a function to handle click events, say, myClick(). Something like:
Code:
void myClick(Object Src, CommandEventArgs e) {
...do something...
}
So... how do I link the two together? I've tried:
Code:
myButton.OnCommand = "myClick";
... but it doesn't seem to work. Any ideas?