M
matthias s
Hi there,
probably a stupid question but i can't figure it out:
I've got a UserControl with a PlaceHolder on it. In my Page_Load I
dynamically add a couple of ImageButtons to that PlaceHolder and add an
EventHandler for the click-event of each ImageButton (say "Button_Click").
The same handler is used for all ImageButtons. When I now click one of the
buttons on my page, the EventHandler gets called ok, but I can't determine
exactly which ImageButton the user clicked.
here is the code adding the image buttons:
for (int i = 0; i < 5; i++)
{
ImageButton btn = new ImageButton();
btn.ImageUrl = "some valid url... omitted";
btn.ToolTip = "test";
btn.AlternateText = "test";
btn.Click += new ImageClickEventHandler(Button_Click);
}
I guess I'm looking for something like a Tag Property of an ImageButton
allowing me to store something like an ID or so.
That must be a very common problem. I guess they teach something like this
within the first 5 hours of "Learn to become a aspx developer."
Any help is greatly apreciated. Thanks in advance,
Matthias
probably a stupid question but i can't figure it out:
I've got a UserControl with a PlaceHolder on it. In my Page_Load I
dynamically add a couple of ImageButtons to that PlaceHolder and add an
EventHandler for the click-event of each ImageButton (say "Button_Click").
The same handler is used for all ImageButtons. When I now click one of the
buttons on my page, the EventHandler gets called ok, but I can't determine
exactly which ImageButton the user clicked.
here is the code adding the image buttons:
for (int i = 0; i < 5; i++)
{
ImageButton btn = new ImageButton();
btn.ImageUrl = "some valid url... omitted";
btn.ToolTip = "test";
btn.AlternateText = "test";
btn.Click += new ImageClickEventHandler(Button_Click);
}
I guess I'm looking for something like a Tag Property of an ImageButton
allowing me to store something like an ID or so.
That must be a very common problem. I guess they teach something like this
within the first 5 hours of "Learn to become a aspx developer."
Any help is greatly apreciated. Thanks in advance,
Matthias