by Solution 2
newButton.Click += NewButton_Click;
by entering a breakpoint on NewButton_Click , the code does not pass
private void NewButton_Click(object sender, ImageClickEventArgs e)
{
ImageButton b = (ImageButton)sender;
System.Diagnostics.Debug.WriteLine("Button " + b.CommandArgument + " was clicked");
I need ImageUrl to visulize in another control
ex: ImageFromThumb.ImageUrl = "url"
}
To perform a click on Image operation, I should at least pass ImageUrl
------------- other possibility
I can create
protected override void OnInit(EventArgs e)
{
ImageButton image = new ImageButton();
image.ID = "image1";
image.ImageUrl = "~/Immagini/Arredi/thumbnails/File_55Frecce-106.jpg";
image.Width = 100;
image.OnClientClick = "ImgShow()";
LiteralControl createDiv = new LiteralControl("<div>");
Page.Form.Controls.Add(createDiv);
Page.Form.Controls.Add(image);
LiteralControl endDiv = new LiteralControl("</div>");
Page.Form.Controls.Add(endDiv);
base.OnInit(e);
}
and on .aspx file
<script type="text/javascript">
function ImgShow(src)
{
var img = document.createElement("img");
img.src = src;
img.width = width;
img.height = height;
img.alt = alt;
document.body.appendChild(img);
}
</script>
the purpose is to have n ImageButton and click on a display on an ImageButton control.
the problem is pass a parameter (ImageUrl) to function ImgShow()