
February 12th, 2002, 10:42 AM
|
|
Contributing User
|
|
Join Date: Dec 2002
Posts: 14,578
  
Time spent in forums: < 1 sec
Reputation Power: 22
|
|
|
dynamically added user controls
Originally posted by : robin (robinvogels@yahoo.com)Hi, I have made some code which adds user controls dynamically. But the problem is that it only works when I fire it off in the Page_load sub. The thing I want to do is to submit a form, using postbacks, and then add the new controls.Can somebody help me?Thanx in advance,RobinThis is my code:dim mycontrol as control dim i as integer for i = 0 to 15 dim row AS new TableRow() dim cell1 as new TableCell() cell1.id="text" & i dim cell2 as new TableCell() cell2.id="ctrl" & i row.cells.add(cell1) row.cells.add(cell2) table1.rows.add(row) mycontrol = FindControl("text" & i) mycontrol.controls.Add(new LiteralControl("test text" & i)) dim myTextBox = new TextBox myTextBox.ID = "myTextBox" & i mycontrol=Page.FindControl("ctrl" & i) mycontrol.controls.Add(myTextBox) next
|