日期:2014-05-17  浏览次数:20452 次

asp.net事件綁定
asp.net的page生成的html代码button都是生成submit控件,这样点击按钮都会提交form,在页面上又没有js,asp.net怎么知道是哪个按钮提交的form并触发后台相应事件?请高手指教

------解决方案--------------------
可以实现,重写Page通知引起回发服务器控件的方法
C# code

 protected override void RaisePostBackEvent(IPostBackEventHandler sourceControl, string eventArgument)
 {
        Type t = sourceControl.GetType();
        System.Reflection.PropertyInfo property = t.GetProperty("UniqueID");
        object uniqueID = property.GetValue(sourceControl, null);    //这个就是你引起回发服务器的控件ID
        base.RaisePostBackEvent(sourceControl, eventArgument);
}