Hi,
I have a repeater control which is populated with a dataset to display a list of products. I have a button within each itemtemplate which passes the primary key from that table as the command argument. I need to be able to pass in the quantity value selected from the dropdown list corresponding to that item.
HTML:
<asp:Repeater ID="rptProducts" runat="server">
<ItemTemplate>
<%#Eval("name")%><br />
<%#Eval("image")%><br />
<%#Eval("Price")%><br />
<asp:DropDownList ID="ddlQty" runat="server">
<asp:ListItem Value="1" Text="1"></asp:ListItem>
<asp:ListItem Value="2" Text="2"></asp:ListItem>
<asp:ListItem Value="3" Text="3"></asp:ListItem>
<asp:ListItem Value="4" Text="4"></asp:ListItem>
<asp:ListItem Value="5" Text="5"></asp:ListItem>
<asp:ListItem Value="6" Text="6"></asp:ListItem>
<asp:ListItem Value="7" Text="7"></asp:ListItem>
<asp:ListItem Value="8" Text="8"></asp:ListItem>
<asp:ListItem Value="9" Text="9"></asp:ListItem>
<asp:ListItem Value="10" Text="10"></asp:ListItem>
</asp:DropDownList>
<asp:Button ID="btnAddBskt" runat="server" CommandName="Add" CommandArgument='<%#Eval("
PID") %>' Text="add to basket" />
<hr />
</ItemTemplate>
</asp:Repeater>
VB
Protected Sub rptProducts_ItemCommand(By
Val source As Object, ByVal e As System.Web.UI.WebControls.
RepeaterCo
mmandEvent
Args) Handles rptProducts.ItemCommand
Select Case e.CommandName
Case "Add"
Dim PID As Integer
Dim Qty As Integer
PID = e.CommandArgument
'Qty = [???????]
functions.addToBasket(Qty,
PID, 1, 1.99)
End Select
End Sub
Thanks in advance,
Rob
Start Free Trial