Programmatically call ImageButton_Click

.Net, ASP Add comments

with a regular button, you can programmatically call the Button_Click by calling:

Button1_Click(Me, EventArgs.Empty);

However, with an ImageButton, you get an error if you use the above method. You need an extra line of code:

ImageClickEventArgs args = new ImageClickEventArgs(1, 1);
ImageButton1_Click(this, args);

Leave a Reply

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in