【问题标题】:Handle Custom Event of User Control Contained in Repeater处理Repeater中包含的用户控件的自定义事件
【发布时间】:2011-06-14 18:20:49
【问题描述】:

我在转发器中有一个用户控件,并且该用户控件引发了一个自定义事件,但我不知道如何处理该事件。

通常我会这样做:

    Protected Sub MyFancyEventRasied(ByVal sender As Object, ByVal e As EventArgs) Handles MyFancyUserControl.MyFancyEvent   
        'do something fancy 
    End Sub

但我不能这样做,因为用户控件位于中继器 ItemTemplate 内。如何处理 ItemTemplate 中的控件事件?

【问题讨论】:

    标签: .net asp.net user-controls repeater


    【解决方案1】:
    <ItemTemplate>
    ...
        <uc1:MyFancyUserControl OnMyFancyEvent="MyFancyEventRasied" ... />
    ...
    </ItemTemplate>
    

    Protected Sub MyFancyEventRasied(ByVal sender As Object, ByVal e As EventArgs)
        'do something fancy 
    End Sub
    

    【讨论】:

      猜你喜欢
      • 2011-01-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-17
      • 2010-11-23
      相关资源
      最近更新 更多