<table> <tr> <td style="width: 100px"> <asp:Label ID="Label2" runat="server" Text="No.Items" Font-Bold="true"></asp:Label> </td> <td> <asp:TextBox ID="txtno" runat="server"></asp:TextBox> </td> <td> <asp:Button ID="btnadd" runat="server" CssClass="btn btn-warning" Text="Add More" OnClick="btnadd_Click" /> </td> </tr> </table> <asp:Repeater ID="Repeater1" runat="server" > <HeaderTemplate> <table class="table table-bordered table-hover"> <thead class="bg-dark lt"> <tr> <th> S.No# </th> <th><table><tr> <th align="center" style="width: 300px"> Item </th> <th align="center" style="width: 405px"> Description </th> <th align="center" style="width: 350px"> Quantity </th> <th align="center" style="width: 300px"> Remarks </th></tr></table></th> </tr> </thead> <tbody> </HeaderTemplate> <ItemTemplate> <tr> <td> <%# Container.ItemIndex + 1 %> </td> <td> <uc1:pousercontrol ID="pousercontrol1" runat="server" /> </td> </tr> </ItemTemplate> <FooterTemplate> </tbody> </table> </FooterTemplate> </asp:Repeater>
protected void btnadd_Click(object sender, EventArgs e) { int i = Convert.ToInt32(txtno.Text); Repeater1.DataSource = Enumerable.Range(0, i); Repeater1.DataBind(); btnadd.Enabled = false; }
protected void btnSave_Click(object sender, EventArgs e) { foreach (RepeaterItem item in Repeater1.Items) { UserControl uc = (UserControl)item.FindControl("pousercontrol1"); //unable to get the properties } }
foreach (RepeaterItem item in rpt1.Items) { UserControl uc = (UserControl)item.FindControl("uc_textbox"); TextBox tb = (TextBox)uc.FindControl("txt1"); Response.Write(tb.Text); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)