在我的项目中,我有5个文本框。 我想在foreach循环中找到每个文本。 Thant为我工作,但是当我在页面上设置设计时,它不起作用。
我的代码:
foreach (Control c in Page.Controls)
{
foreach (Control ctrl in c.Controls)
{
if (ctrl is TextBox)
{
string text = ((TextBox)ctrl).Text;
if (!string.IsNullOrWhiteSpace(text))
{
Zone.addPermission(new User(text));
}
}
}
}