您的位置:首页 > 职场人生

遍历窗体上的控件

2011-07-11 14:45 176 查看
验证用户页面所有的RadioButtonList是否进行了选择

public void ValidateField()

{

for(int i=0;i<Page.Controls.Count;i++)

{

foreach(System.Web.UI.Control control in Page.Controls[i].Controls)

{

if(control is RadioButtonList)

{

if(String.IsNullOrEmpty((control as RadioButtonList).SelectedValue))

{

MessageBox(this.page,"没有填写");

return ;

}

}

}

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  职场 控件 休闲