对于循环调用TextBox和Label索引器(i)以显示ArrayList

本文关键字:索引 ArrayList 显示 Label TextBox 于循环 循环 调用 | 更新日期: 2023-09-27 18:20:52

我可以在aspxTextBox中创建一些带索引号的文本框吗?或者也可以创建其他控件,比如Label。我想用它们来显示带索引器的数组文本。。。

string[] TEST= new string[2] {"This is TextBox1(0)","This is TextBox1(1)"}; //this is text-array
for (int i=0;i<=1;i++)
{
   TextBox1(i).text="";   //how to draw this control too with DevExpr:ASPxTextBox?
   TextBox1(i).text=TEST[i];
}

任何想法。。。我想在ASP.NET中使用C#语言来实现这一点。

感谢

对于循环调用TextBox和Label索引器(i)以显示ArrayList

您可能正在寻找这个:

 string[] TEST= new string[2] {"This is TextBox1(0)","This is TextBox1(1)"}; //this is text-array
 for (int i=0;i<=1;i++)
 {
 TextBox txt = new TextBox();
 txt.ID = "textBox"+i;
 txt.Text = Test[i];
 form1.Controls.Add(txt);
}

如果您正在动态地进行控制,那么您将不得不注意它们的位置以及