如何清除所有文本框 [英] how to clear all textboxes
本文介绍了如何清除所有文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有内容页面我有1个文本框,我希望清除主页面上按钮点击的所有文本框的值.plz帮帮我?
i have content page i have 1oo textboxes and i want clear the value of all textboxes on button click which is on master page.plz help me?
推荐答案
protected void Button2_Click(object sender, EventArgs e)
{
ClearInputs(Page.Controls);
}
void ClearInputs(ControlCollection ctrls)
{
foreach (Control ctrl in ctrls)
{
if (ctrl is TextBox)
((TextBox)ctrl).Text = string.Empty;
ClearInputs(ctrl.Controls);
}
}
来自如何在C#.NET中单击清除多个TextBox值 [ ^ ]
这篇关于如何清除所有文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文