当前位置: 代码迷 >> ASP.NET >> 请教怎么才能枚举同一个网页上的控件?
  详细解决方案

请教怎么才能枚举同一个网页上的控件?

热度:8743   发布时间:2013-02-25 00:00:00.0
请问如何才能枚举同一个网页上的控件???
假设页面上有TextBox1,TextBox2.....TextBox20  
设一个按钮  
要一次性清空这些TextBox.Text   如何才能用循环做到?



------解决方案--------------------------------------------------------
foreach (Control xc in this.form1.Controls)
{
if (typeof(System.Web.UI.WebControls.TextBox) == xc.GetType())
{
xc.Visible = false;
}
}
  相关解决方案