In my project I have 5 textboxes. I want to find the text of each one on foreach loop. Thant's works for me, but when I set a design on page, it doesn't work.
My code:
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));
}
}
}
}