当前位置: 代码迷 >> ASP.NET >> 求个技巧有关问题
  详细解决方案

求个技巧有关问题

热度:2895   发布时间:2013-02-26 00:00:00.0
求个技巧问题
一个表单页面,里面有很多的文本框,这个页面有一个取消按钮,当点几这个是,文本框中的内容就清空
txt_first.Text= " ";
txt_last.Text= " ";
txt_pcs.Text= " ";
txt_date.Text= " ";
txt_clno.Text= " ";
txt_actual.Text= " "
后面还有很多..............................有没有什么好的方法不要写这么多,可以用一个什么语句替代????

------解决方案--------------------------------------------------------
foreach (Control c in this.Form.Controls)
{
if (c.GetType() == typeof(TextBox)) (c as TextBox).Text = " ";
}
  相关解决方案