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

admin2019-03-29  71

问题 请编程遍历页面上所有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://jikaoti.com/ti/Jag7FFFM
0

最新回复(0)