函数功能:遍历出页面所有的TextBox 和 DropDownList 将它们的Enable 设置为False
public void SetControl(ControlCollection c)
{
foreach (Control item in c)
{
if (item.HasControls())
{
SetControl(item.Controls);
}
if (item is TextBox)
{
((TextBox)(item)).Enabled = false;
}
if (item is DropDownList)
{
((DropDownList)(item)).Enabled = false;
}
}
}
{
foreach (Control item in c)
{
if (item.HasControls())
{
SetControl(item.Controls);
}
if (item is TextBox)
{
((TextBox)(item)).Enabled = false;
}
if (item is DropDownList)
{
((DropDownList)(item)).Enabled = false;
}
}
}