动态创建控件 利用PlaceHolder控件,这东西在ASP.NET 2.0 Mutil-View和Master Page中运用的就更加多了。
以下是引用片段: Sub Page_Load() Dim i as Integer For i=0 to 4 Dim myUserControl as Control myUserControl = Page.LoadControl(“foo.ascx”) PlaceHolder1.Controls.Add(myUserControl) PlaceHolder1.Controls.Add(New LiteralControl(“<br>”)) Next i End Sub |