日期:2009-07-15 浏览次数:21127 次
1.整个页面的判断
foreach(Control ctl in this.Controls[1].Controls)
2.指定formID里TextBox 判断
先找出你的Form的ID
protected HTMLForm yourformID;
foreach (object obj in yourformID.Controls)
{
if (obj is TextBox)
{
TextBox tb = (TextBox)obj;
if (tb.Text = string.Empty)
{
Response.Write("<script>alert('" + tb.ID + "的值为空。');</script>;")
}
}
}