asp.net/VB:中继器中的用户控件 - 捕获按钮的单击事件
我有一个用户控件
。
在此用户控件中,我有一个Repeater
。
在这个中继器中,我再次有一个用户控件
。
如果我尝试捕获此用户控件中 ImageButton
的 click 事件
,我什么也得不到,因为该事件尚未触发。
有没有办法捕捉这个事件?
一些代码:
第一个用户控件:
<asp:Repeater ID="Rpt" runat="server">
<ItemTemplate>
<uc1:myUserControl id="myUserControl1" runat="server" />
</ItemTemplate>
</asp:Repeater>
在 myUserControl 中
<asp:LinkButton ID="myUserControlBtn" runat="server" OnClientClick="thisEventIsFiring();" OnClick="btn_Click" Text="btn" />
此事件未触发:
Protected Sub btn_Click(sender As Object, e As EventArgs) Handles btn.Click
' I am not firing
End Sub
此外,以下内容不起作用,因为它不返回任何内容:
If Request(btn.UniqueID) IsNot Nothing
'check if Button was clicked
End If
i have a User Control
.
In this user control I have a Repeater
.
In this repeater I have again a User Control
.
If I try to catch the click event
of an ImageButton
in this user control, I'm gettin nothing because the event has not been fired.
Is there a way to catch this event?
some code:
first user control:
<asp:Repeater ID="Rpt" runat="server">
<ItemTemplate>
<uc1:myUserControl id="myUserControl1" runat="server" />
</ItemTemplate>
</asp:Repeater>
in myUserControl
<asp:LinkButton ID="myUserControlBtn" runat="server" OnClientClick="thisEventIsFiring();" OnClick="btn_Click" Text="btn" />
This event isn't firing:
Protected Sub btn_Click(sender As Object, e As EventArgs) Handles btn.Click
' I am not firing
End Sub
Also the following does not work because it returns nothing:
If Request(btn.UniqueID) IsNot Nothing
'check if Button was clicked
End If
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
应该是
It should be