[英]LinkButton in Repeater causes postback and button doesn't
Ok so I have an update panel sorrounding my controls. 确定,所以我有一个更新面板围绕我的控件。 I have 2 dropdownlists which have functions they run from codebehind and a repeater of items. 我有2个下拉列表,它们具有从代码隐藏运行的功能和项目的转发器。 I've done the test in a Repeater using a button it doesn't do a postback, but the linkbutton does. 我已经在Repeater中使用按钮进行了测试,该按钮不进行回发,但是linkbutton可以进行回发。 What am I doing wrong? 我究竟做错了什么?
also this is inside a usercontrol no aspx page. 也是在usercontrol no aspx页面内。
<asp:UpdatePanel ID="upLocation" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<asp:Repeater ID="rptMuniProducts" runat="server">
<HeaderTemplate>
<table class="table">
<thead>
<tr>
<th class="w80"></th>
<th>Product</th>
<th>Product Type</th>
</tr>
</thead>
<tbody>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td class="actions">
<asp:Button ID="btnProd" runat="server" OnClick="btnProd_Click" Text="test" />
<asp:LinkButton ID="lnkDeleteProd" runat="server" OnClick="lnkDeleteProd_Click">Link Test</asp:LinkButton>
<asp:HiddenField ID="hdnId" runat="server" Value='<%# DataBinder.Eval(Container, "DataItem.Id") %>' />
</td>
<td><%# DataBinder.Eval(Container, "DataItem.Name") %></td>
<td><%# DataBinder.Eval(Container, "DataItem.Producttype") %></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</tbody>
</table>
</FooterTemplate>
</asp:Repeater>
</ContentTemplate>
</asp:UpdatePanel>
Have you tried setting ClientIDMode=Auto on the LinkButton? 您是否尝试过在LinkButton上设置ClientIDMode = Auto? There's a long-standing .NET bug with doPostBack and non-auto client ids. 有一个长期存在的.NET错误,包含doPostBack和非自动客户端ID。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.