前台.aspx<html>
<head>
<title> New Document </title>
</head> <body>
<img alt=""/>
</body>
</html>后台.cs
protected void Button_Click(object sender, EventArgs e)
{
//代码
}前台的img怎么加个点击事件调用后台的Button_Click方法不要说换成<asp:ImageButton ID="ImageButton1" runat="server" />控件
<head>
<title> New Document </title>
</head> <body>
<img alt=""/>
</body>
</html>后台.cs
protected void Button_Click(object sender, EventArgs e)
{
//代码
}前台的img怎么加个点击事件调用后台的Button_Click方法不要说换成<asp:ImageButton ID="ImageButton1" runat="server" />控件
http://blog.csdn.net/porschev/archive/2010/10/15/5943579.aspx
实现ICallbackEventHandler接口
public partial class _Callback : System.Web.UI.Page,ICallbackEventHandler
{
}
{
ajax请求url="xx.aspx?name=" + name}
补充说明:还有一种就是在<img>外面套一个<a>标签,设置属性href="/xxx.aspx?canshu="+你的参数,然后到一个新的页面xxx.aspx去处理,然后返回操作结果。,这个就是得新建一个专门的处理页面。个人觉得onclick=document.getElementById("Button").click();最简单,只要设置个隐藏按钮就行了。