想遍历窗口所有控件,切出现这个,求大侠
public void GetAllControls(Control control)
{
for (int i = 0; i < this.Controls.Count; i++)
{
foreach (System.Web.UI.Control control in this.Controls[i].Controls)
{
if (control is TextBox)
(control as TextBox).Text = "";
}
}
}
在this.Controls出现缺少using或者程序集引用,请问各路大侠该如何去解决
[解决办法]
public void GetAllControls()
{
UIElementCollection Childrens = this.Grid1.Children;
foreach (UIElement element in Childrens)
{
if (element is Button)
{
Button temp = element as Button;
//
}
}
}