嘿嘿 试一试 Me.Form.Controls For Each ctrl As Control In Me.Form.Controls Response.Write(ctrl.ToString() + "<br/>") Next
public void InitializePage(System.Web.UI.Control Page) { int nPageControls = Page.Controls.Count; for (int i = 0; i < nPageControls; i++) { foreach (System.Web.UI.Control Control in Page.Controls[i].Controls) { if (Control is TextBox) { (Control as TextBox).Text = ""; } } } }
Controls[3]也可能是别的下标号
原来1.1在Design Time下用Site.Container.Components可以抓到,现在2.0却不行了。
搞不懂ms到底要做什么?
Response.Write(ctrl.ToString() + "<br/>")
Next
{
int nPageControls = Page.Controls.Count;
for (int i = 0; i < nPageControls; i++)
{
foreach (System.Web.UI.Control Control in Page.Controls[i].Controls)
{
if (Control is TextBox)
{
(Control as TextBox).Text = "";
}
}
}
}
不太明白是什么意思?现在还可以在CS中定义Component吗?