A larger code sample would be helpful however I suspect your having scope issues. What is 'this' referring to in relation to where your code is being executed?
Try this:
private void Button1_Click(object sender, System.EventArgs e)
{
string allTextBoxValues = "";
foreach (Control c in Page.Controls)
{
foreach (Control childc in c.Controls)
{
if (childc is TextBox)
{
allTextBoxValues += ((TextBox)childc).Text + ",";
}
}
}
}
For more information on accessing the
control collection[
^]