#@@不要怪分少,我钱很好
多壮志 2005-01-25 02:44:16 private int GetTextBoxIndex()
{
int i;
int result;
///默认先设置为-1
///
System.Web.UI.WebControls.TextBox tt=new TextBox();
result=-1;
for (i=0;i<this.Controls.Count;i++)
{
if (this.Controls[i].GetType()==tt.GetType())
{
result=i;
break;
}
}
tt.Dispose();
return result;
}
上文中的一句if (this.Controls[i].GetType()==tt.GetType()),是否有其他方法得到,
如果需要创建一个TextBox的示例来获得,挺麻烦的,或者是系统中有没有等效的枚举,或者方法得到
TextBox的type