This is the Design:::
<asp:Panel ID="Panel1" runat="server">
</asp:Panel>
<asp:Button ID="Button2" runat="server" Text="Button" />
<asp:Label ID="l1" runat="server" Text="0"></asp:Label>
<asp:Label ID="l2" runat="server" Text="0"></asp:Label>
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim i As Integer = 0
Dim j As Integer = 0
l1.Text = l2.Text
l2.Text = Val(l2.Text) + 10
i = Val(l1.Text)
j = Val(l2.Text)
MsgBox(i & " " & j)
While (i < j)
Dim b As Button = New Button()
b.ID = "b" + i.ToString()
b.Text = b.ID
Panel1.Controls.Add(b)
i = i + 1
End While
End Sub
This contains a button on click it should create 10 unique buttons..
i want to append all created buttons with existing buttons..
but the program is overriding instead of adding controls to the panel
help me.
I think you want to add 10 dynamic controls on every button click. The problem you are facing right know is that on first click it adds 10 button controls, and on subsequent clicks it overrides the previous controls. Dynamic controls are created every time the page is requested so you have to create them on every request.
I write the following code to solve your query and it works: