Click to See Complete Forum and Search --> : Get a ref to listbutton pressed in a datagrid


Diondk
October 6th, 2004, 04:41 AM
Hi,

I have a listbutton template in a datagrid declared as follows:-


<asp:DataGrid id="PreciousGemsDG" runat="server" OnInit="PreciousGemsDG_Init" >
<Columns>

<ItemTemplate>
<asp:TextBox id="Quantity" runat="server" ... width="40px" />
</ItemTemplate>

<asp:BoundColumn DataField="ProductID" ...></asp:BoundColumn>

<asp:TemplateColumn>
<ItemTemplate>
<asp:ListButton id="lbAddToButton" Click="AddToButtonClick"> </asp:ListButton>
</ItemTemplate>
</asp:TemplateColumn>

</Columns>
</asp:DataGrid>

How do I determine the instance of listbutton clicked in order to get a hold of the
quantity the user entered into the "quantity" field. I want to use this value and the
"ProductID" value as input parameters to update the cart in the click event of the "AddToCart" ListButton.

If there is a better method, please advise. I am very new to ASP and think along conventional(desktop) programming lines.

Many Thanks,
Dion.