Hi I have placed some code in an updatepanel on a web page and all works fine except for one button. Whats displayed in the updatepanel is just a number of items that a user has added to a shopping cart.
The buttons that work are btnPlus and btnMinus, they increase the quantity of an item in a shopping cart, and in their code behind this updates the quantities that are being stored in the database.
What's not working is the btnDelete - this is supposed to delete the item from the shopping cart.
When I click it nothing happens - but what's really strange(at moment) is that it does work after I click after I click btnPlus or btnMinus.
Any ideas?
<asp:UpdatePanel ID="pnlSmallCheckout" runat="server">
<ContentTemplate>
<div class="basket">
<%Dim SmallCounter as integer = 0 %>
<asp:Repeater ID="rptSmallCheckout" runat="server">
<ItemTemplate>
<div class="item">
<div class="image">
<img src="/graphics/placeholders/sweets.jpg">
</div>
<div class="title">
<%#Eval("PTitle")%> x<span class="amount" id="span_small_<%=SmallCounter%>"><%#Eval("Quantity") %></span><asp:TextBox ID="txtQuantity" runat="server" Text='<%# Eval("Quantity") %>' MaxLength="3" Style="display: block"></asp:TextBox>
<asp:TextBox ID="txtSmallNumKilos" runat="server" Style="display: block"></asp:TextBox>
<asp:Literal ID="ltrSmallNumKilos" runat="server" Visible="false"></asp:Literal>
</div>
<div class="controls">
<asp:Button ID="btnMinus" CssClass="button minus" Text="-" runat="server" CommandName='<%# Eval("ItemID") %>' OnClientClick="if (!update_qty('minus',this)) return false;" OnClick="btnUpdate_Click" />
<asp:Button ID="btnPlus" CssClass="button plus" Text="+" runat="server" CommandName='<%# Eval("ItemID") %>' OnClientClick="if (!update_qty('plus',this)) return false;" OnClick="btnUpdate_Click" />
<asp:Button ID="btnDelete" runat="server" Text="x" CssClass="button remove" CommandName='<%# Eval("ItemID") %>' OnClientClick="update_total(this);" OnClick="btnDelete_Click" />
</div>
</div>
<%SmallCounter=SmallCounter+1 %>
</ItemTemplate>
</asp:Repeater>
<!-- item -->
</div>
</ContentTemplate>
<Triggers>
</Triggers>
</asp:UpdatePanel>
Any ideas?
Are you getting any javascript error? Check using firebug / other tools?
Errors might be interfering with the updatepanel postback event.