请编程遍历页面上所有TextBox控件并给它赋值为string.Empty?

admin2019-03-29  47

问题 请编程遍历页面上所有TextBox控件并给它赋值为string.Empty?

选项

答案protected void Page_Load(object sender, EventArgs e) { foreach (Control ctl in Page.Controls[0].Controls) { if (ctl.GetType().Name == "TextBox") { TextBox tb = new TextBox(); tb = (TextBox)this.FindControl(ctl.ID); tb.Text = ""; } } }

解析
转载请注明原文地址:https://kaotiyun.com/show/LxmZ777K
0

最新回复(0)