我有这个标记Main.ascx:
asp:Repeater ID="rptSource" runat="server">
<ItemTemplate>
<uc1:CustomControlsUC ID="CustomControlsUC1" runat="server" DataSource='<%#Container.DataItem %>' />
</ItemTemplate>
</asp:Repeater>
和CustomControlsUC.ascx
Public Event Entered(ByVal sender As Object, ByVal e As CommandEventArgs)
和
Public Sub CustomValidation(sender As Object, args As CommandEventArgs)
RaiseEvent Entered(Me, args)
End Sub
并且在我的Main.ascx中,我在那里尝试处理此事件。
Protected Sub rptSource_ItemDataBound(sender As Object, e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptSource.ItemDataBound
Dim rpt As inc_CustomControlsUC = CType(e.Item.Controls(1), inc_CustomControlsUC)
AddHandler rpt.Entered, AddressOf HandleThis
End Sub
但是在这部分AddHandler rpt.Entered,AddressOf HandleThis,我没有这个Entered事件:
我该怎么做?
答案 0 :(得分:0)
尝试这样的事情:
<asp:Repeater ID="rptSource" runat="server">
<ItemTemplate>
<uc1:CustomControlsUC
...
OnEntered="HandleThis"
/>
</ItemTemplate>
</asp:Repeater>