Repeater Item命令不起作用 [英] Repeater Item command not working
问题描述
我有一个转发器,我已经拿了一张桌子(这是为了更好的用户界面)在该表中我有一个链接按钮...我想写一些应该在用户点击添加按钮时执行的代码..
我在转发器的ItemCommand事件中编写了该代码但是控制器没有进入该事件..
代码如下< br $>
asp代码:
Hi, I have a repeater in which I have taken a table (Which was for better UI) in that table I have a link button... I want to write some code that should be executed when user click on add button..
I wrote that code in ItemCommand event of repeater but controll is not going inside that event..
code is as follow
asp code:
<asp:Repeater ID="rpt1" runat="server" OnItemCommand="rpt1_ItemCommand">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="13%" align="left" valign="top">
<a id="StarRating" class='<%# GetStarRating(Eval("Rating")) %>' runat="server"></a>
</td>
<td width="17%" align="left" valign="top">
<div class="radius-btn">
<a href="#" class='<%# Getclass(Eval("MyvuReco")) %>'>
<%# Eval("MyvuReco") %></a></div>
</td>
<td width="58%" align="left" valign="top" class="nav-grey">
NAV : <span>
<%# Eval("navrs") %></span> as recorded on
<%# Eval("navdate") %>
</td>
<td width="30%" align="right" class="remove">
<asp:LinkButton runat="server" ID="lnkBasket" CommandName="add" class="add-basket"
>Add</asp:LinkButton>
</td>
</tr>
</table>
和Codebehind
and Codebehind
Protected Sub rpt1_ItemCommand2(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles rpt1.ItemCommand
my code
End Sub
为什么控制不参与该事件的任何原因在调试
any reason why control is not going in that event while debugging
推荐答案
时,你定义了Reapeater的属性OnItemCommand = rpt1_ItemCommand
you define property of Reapeater OnItemCommand="rpt1_ItemCommand"
Protected Sub rpt1_ItemCommand2(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles rpt1.ItemCommand
my code
End Sub
你应该传递转发器中的rpt1_ItemCommand2
itemcommand
you should pass rpt1_ItemCommand2
in repeater itemcommand
请参阅:如何使用参数进行链接按钮点击[ ^ ]
如果需要,转换为VB.NET。
问候..
See this : How to make a linkbutton onclick with parameters[^]
Convert to VB.NET if required.
Regards..
这篇关于Repeater Item命令不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!