ASP.NET、WinForm - 判断整个页面文本框是否为空
foreach(Control ctrl in Page.Controls)
{
foreach(Control childc in ctrl.Controls)
{
switch(childc.GetType().ToString())
{
case "System.Web.UI.WebControls.TextBox" :
TextBox txt = (TextBox)childc;
txt.ReadOnly = true;
break;
case "System.Web.UI.WebControls.Label" :
Label lbl = (Label) childc;
break;
case "System.Web.UI.WebControls.DropDownList" :
DropDownList ddl = (DropDownList) childc;
break;
}
}
}
posted on 2015-08-02 08:45 ultrastrong 阅读(553) 评论(0) 收藏 举报
浙公网安备 33010602011771号