解决方法
刚刚遇到这个问题,并认为我会发布一个答案总结我发现,加上我的实际问题。
1. img tags with src="" or Image tags with ImageUrl=" 2. Using AutoEventWireup="true" and adding a page handler 3. Having manually added the event handler (more common for C# than VB) 4. Handling both MyBase.Load and Me.Load
最后我的问题….
我的页面继承自一个包含页面加载处理程序的类,该页面继承自具有页面加载处理程序的类。
Public Class C1 Inherits System.Web.UI.Page Protected Overridable Sub PageLoad(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.Load End Sub End Class Public Class C2 Inherits C1 Protected Overrides Sub PageLoad(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.Load MyBase.PageLoad(sender,e) End Sub End Class Public Class MyPage Inherits C2 Protected Overrides Sub PageLoad(ByVal sender As Object,ByVal e As System.EventArgs) MyBase.PageLoad(sender,e) End Sub End Class
我测试了这个,如果你把一个Handles在MyPage中的方法,它会得到3次的打击…