vincentw56
IS-IT--Management
I have created a product listing page that has a textbox next to the add to cart button. The textbox is to allow the customer to put in a quantity. The problem is the default value is over-ridding the user entered value. I have included some of the code below. Anyone seen this before? Thanks.
ASPX Code:
Code Behind:
ASPX Code:
Code:
<form id="frmproduct" runat="server">
<asp:repeater id="rpProducts" runat="server" onitemcommand="rpProducts_ItemCommand">
<itemtemplate>
<div style="FLOAT: left; WIDTH: 245px" class="prodprice">QTY:
<asp:textbox id="txtQTY" runat="server" width="40px" text="1" />
<asp:linkbutton runat="server" commandname="AddToCart" id="lbAddToCart">
<img alt="Add To Cart" src="images/addtocart.gif" border="0" height="22" width="100"></asp:linkbutton></div>
</div>
</itemtemplate>
</asp:repeater></form>
Code Behind:
Code:
Sub rpProducts_ItemCommand(ByVal sender As Object, ByVal e As RepeaterCommandEventArgs)
Dim strTitle As Label = rpProducts.Items(e.Item.ItemIndex).FindControl("lblTitle")
Dim strPrice As Label = rpProducts.Items(e.Item.ItemIndex).FindControl("lblPrice")
Dim strPartNo As Label = rpProducts.Items(e.Item.ItemIndex).FindControl("lblPartNo")
Dim strQTY As TextBox = rpProducts.Items(e.Item.ItemIndex).FindControl("txtQTY")
Response.Write(txtQTY.Text)
End Sub