读书人

求个技巧有关问题

发布时间: 2011-12-23 23:32:01 作者: rapoo

求个技巧问题
一个表单页面,里面有很多的文本框,这个页面有一个取消按钮,当点几这个是,文本框中的内容就清空
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 = " ";
}

读书人网 >asp.net

热点推荐