<script runat=server>
void Page_Load(Object sender , EventArgs e)
{
string strFeatured;
Random RanNum = new Random();
Control ctlControl;
strFeatured = "FeaturedProduct" + RanNum.Next( 1, 3 ) + ".ascx";
ctlControl = LoadControl( strFeatured );
plhFeatured.Controls.Add( ctlControl );
}
</Script>
<html>
<head><title>DisplayFeaturedProduct.aspx</title></head>
<body>
<div style=" height:100%; width:100%">
<div style=" padding-left:200px">
<asp:PlaceHolder
id="plhFeatured"
Runat="Server" />
</div>
</div>
</body>
</html>
PlaceHolder 一个容器可以放服务器控件和用户自定义控件