ASP.NET 使用C#如何依次获取所有服务器控件类型

2025-02-25 00:04:43
推荐回答(1个)
回答1:

页面放个panel
foreach(Control ctrol in this.panel1.Controls )
{
if ( ctrol.GetType().ToString() == "System.Windows.Forms.Button" ) )
{
//your code
}
if ( ctrol.GetType().ToString() == "XXXXX" ) )
{
//your code
}
}