你的控件是拖上去的,还是动态加载的,如果是前者,你换componet.getienumable()试试,用枚举接口 .movenext .current 遍历试试,如果是后者,就要注意aspx页加载各部分和事件处理的顺序 because the control hierarchy is not flat, you need to do a recursion
void GetTextBox(Control c, StringBuilder sb) { if (c is TextBox) sb.Append(c.ID + ",");
foreach (Control cc in c.Controls) GetTextBox(cc, sb); }
then in your page code, do
StringBuilder sb = new StringBuilder(); GetTextBox(this, sb); string s = sb.ToString();