Non ho capito molto quello che vuoi,:master: poi non lavoro in c#
ma ho provato così: vedi se serve
codice:
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Init(object sender, EventArgs e)
{
for (int i = 1; i <= 5; i++)
{
ImageButton ib = (ImageButton)this.FindControl("btn_exp_" + i.ToString());
ib.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton_click);
}
}
private void ImageButton_click(object sender, ImageClickEventArgs e)
{
ImageButton ib = (ImageButton) sender;
this.Response.Write("ID = " + ib.ID + ", CommandArgument = " + ib.CommandArgument + "
");
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Pagina senza titolo</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ImageButton ID="btn_exp_1" runat="server" CommandArgument="1" />
<asp:ImageButton ID="btn_exp_2" runat="server" CommandArgument="2" />
<asp:ImageButton ID="btn_exp_3" runat="server" CommandArgument="3" />
<asp:ImageButton ID="btn_exp_4" runat="server" CommandArgument="4" />
<asp:ImageButton ID="btn_exp_5" runat="server" CommandArgument="5" />
</div>
</form>
</body>
</html>