Hi There,
I have a shopping cart app that displays products along with a textbox
(to enter quantity) and an image button to add the item to the
shopping cart. Please explain why my below Button_Click procedure
does not retrieve the value of the textbox where the button was
clicked.
Thanks in Advance,
Darren
Sub Button_Click(s as Object, e as ImageClickEvent Args)
Dim Btn As System.Web.UI.W ebControls.Imag eButton = s
Dim iId as integer
iId=Btn.Command Argument
Response.write (iId)
Dim tb as System.Web.UI.W ebControls.Text Box =
btn.Parent.Find Control("txtVal ue")
Response.write ("TextBox Value=" & tb.Text)
End Sub
-------------------------------------------------------
<form id="frmProducts " runat="server">
<asp:repeater id="rptProducts " Runat="server">
<ItemTemplate >
a href="ProductIn fo.aspx?id=<%# DataBinder.Eval (Container.Data Item,
"prodid") %>"><%# DataBinder.Eval (Container.Data Item, "prodname")
%></a></b></td>
<%# DataBinder.Eval (Container.Data Item, "catdesc") %></td>
<%# formatcurrency( DataBinder.Eval (Container.Data Item,
"retailprice"), 2) %>
member price: <b> <%#
formatcurrency( DataBinder.Eval (Container.Data Item, "memberprice"), 2)
%></b></td>
<asp:TextBox runat="server" width="20" name="txtValue" id="txtValue"
CommandArgument =<%# DataBinder.Eval (Container.Data Item, "prodid") %>
/>
<asp:imagebutto n id=btnAddCart CommandArgument =<%#
DataBinder.Eval (Container.Data Item, "prodid") %> BorderWidth="0"
onclick=Button_ Click Runat="server" ImageUrl="Frame/btnAdd.gif"/>
</ItemTemplate>
</asp:repeater>