当前位置:编程学习 > C#/ASP.NET >>

如何给溶器里的文本控件赋值?

如何给panel容器里的几个textbox文本控件用循环语名赋值?还请大家多多指教! --------------------编程问答--------------------

foreach (Control c in panel1.Controls)
{
   if (c is TextBox)
   {
      TextBox t = (TextBox)c;
      t.Text = "aaa";
   }
}
--------------------编程问答--------------------

for(int i=1;i<=10;i++)
{
   TextBox tb=(TextBox)Panel1.FindControl("TextBox"+i);
   tb=i;
}
--------------------编程问答-------------------- foreach (Control c in panel1.Controls)
{
   if (c is TextBox)
   {
      TextBox t = (TextBox)c;
      t.Text = "aaa";
   }
}
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,