I want to create a group of buttons with a for loop with the name or id of each button the for loop variable on the end of it.<BR><BR>In ASP it would look like this.<BR><%<BR> <BR> for i = 0 to 10<BR>%> <BR> <input type="Submit" value=http://aspmessageboard.com/archive/index.php/"<%=i%>" name="button"<%=i%> ><BR> <BR><%<BR> next<BR>%> <BR><BR><BR>Asp.net that I trying to use.<BR><%<BR> dim i as Integer <BR> for i = 0 to 10<BR>%> <BR> <asp:button id="button"&<%# i%> runat=server/><BR><%<BR> next<BR>%> <BR><BR>Thank you<BR>AaronHi Aaron,<BR><BR>Each ASP.NET Form contains a Controls collection. One of the Controls in that collection is always the default control of the form. Because the Form control inherits from System.Web.UI.WebControls, just as the Page object does, it also has a Controls collection. When you dynamically create a control and need to handle the events it raises on the server, you need to add your new control to the server-side form's Controls collection.<BR><BR>Here is some code that dynamically creates 10 buttons, for some reason, the FOR loop executes twice, thus it tries to create the same button.ID twice which generates an error. Maybe you can see what the prob is.<BR><BR>I'm not sure if this is the best way to create buttons dynamically, but I do miss the old ASP way of being able to make dynamic buttons as you mentioned in your code example. <BR><BR><script language = "vb" runat = "server"><BR><BR>Sub Page_Load(ByVal sender As System.Object, _<BR> ByVal e As System.EventArgs) Handles MyBase.Load<BR> <BR> Dim i as Integer<BR> Dim PixelY as Integer<BR> PixelY = 50<BR> For i = 1 to 10<BR> <BR> Dim button As New System.Web.UI.WebControls.Button()<BR> button.Text = "Click me"<BR> button.Style.Item("left") = "10px"<BR> button.Style.Item("top") = PixelY & "px"<BR> button.Style.Item("position") = "absolute"<BR> <BR> 'Dynamically assign name to button (does not work cos the for loop is being executed twice ???<BR> 'button.ID = "myButton" & i<BR> <BR> Me.FindControl("Form1").Controls.Add(button)<BR> <BR> PixelY += 30<BR> myDiv.innerHTML += "<BR>" & i<BR> Next<BR> <BR>End Sub<BR><BR></script><BR><BR><div id = "myDiv" runat = "server" /><BR><BR><form id = "Form1" runat = "server"><BR> <BR></form>