billchestnut
New Member
UpdatePanel to add rows onto a table using a button as a trigger. When the trigger is pressed, it works the first time. I require the method of adding one row per trigger click. HTML/ASP markup \[code\]<p class="tblTitle">Recorded Bags</p> <asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="upRecorededBags"> <Triggers> <asp:AsyncPostBackTrigger ControlID="btnAddBag" EventName="click" /> </Triggers> <ContentTemplate> <asp:Label runat="server" ID="lblUpdate" ></asp:Label> <asp:Table runat="server" ID="tblRecorededBags"> <asp:TableRow> <asp:TableHeaderCell>Amount</asp:TableHeaderCell> <asp:TableHeaderCell>Drop Bag Number</asp:TableHeaderCell> </asp:TableRow> </asp:Table> </ContentTemplate></asp:UpdatePanel>\[/code\]C# Codebehind\[code\]protected void addDropBag(object sender, EventArgs e){ // Append rows to table TableRow tRow = new TableRow(); tblRecorededBags.Rows.Add(tRow); TableCell tCell = new TableCell(); tRow.Cells.Add(tCell); tCell.Controls.Add(new LiteralControl("Hello"));} \[/code\]