how to add onclentclick and onclick events from code behind to image button. I wrote some code it shows confirm message for onclientclick event but not firing onclick event.
my code is as following..
ImageButton img = new ImageButton();
img.ID = "img1";
img.Visible = true;
img.OnClientClick = "alert(confirm('Are you sure you want to delete folder with files ?'));";
img.Click += new ImageClickEventHandler(img_Click);
img.ImageUrl = "~/images/admin/remove.png";
Event's code is :
void img_Click(object sender, ImageClickEventArgs e)
{
//code what i want to implement
}
I think the line you have written:
Should be replaced with:
as no need of alert for confirm box.