C# 面试题解析-请遍历页面上所有的TextBox控件并给它赋值为string.Empty
2008-05-29 23:28
645 查看
请遍历页面上所有的TextBox控件并给它赋值为string.Empty
网上能查到的一些解法的问题
第一种,遍历this.Controls
代码如下:foreach (Control ctl in this.Controls)
for(int i=0;i<inPage.Controls[1].Controls.Count;i++)
private void InitialControl(ControlCollection objControlCollection)
{
foreach (System.Web.UI.Control objControl in objControlCollection)
{
if (objControl.HasControls())
{
InitialControl(objControl.Controls);
}
else
{
if (objControl is System.Web.UI.WebControls.TextBox)
{
((TextBox)objControl).Text = String.Empty;
}
}
}
}
相关文章推荐
- C# 面试题解析-请遍历页面上所有的TextBox控件并给它赋值为string.Empty
- C# 面试题解析-请遍历页面上所有的TextBox控件并给它赋值为string.Empty
- C# 面试题解析-请遍历页面上所有的TextBox控件并给它赋值为string.Empty
- 遍历页面所有TextBox控件并给它赋值为string.Empty
- 遍历页面上所有的TextBox控件并给它赋值为string.Empty
- 遍历页面所有Textbox控件并给他赋值为string.empty
- 遍历页面所有TextBox控件并给它赋值为string.Empty
- 遍历页面上所有TextBox,并赋值为String.Empty
- asp.net遍历页面中所有TextBox,并赋值为String.Empty的方法
- asp.net(C#)遍历页面上所有的TextBox控件并给它赋值
- 遍历页面上所有TextBox,并赋值为String.Empty(Asp.Net和WinForm)
- 遍历页面上所有TextBox,并赋值为String.Empty
- 遍历页面中所有的TextBox,并将值设置成String.Empty
- 遍历页面上所有TextBox控件并给它赋值为string.Empty
- 请编程遍历页面上所有TextBox控件并给它赋值为string.Empty?
- 请编程遍历页面上所有TextBox控件并给它赋值为string.Empty?
- C# .NET 遍历一个Web页面中所有的TextBox控件 并设置读写属性
- 编程遍历页面上所有TextBox控件并给它赋值为string.Empty?
- 编程遍历页面上所有TextBox控件并给它赋值为string.Empty?(webform&winform)
- 遍历页面上所有TextBox控件并给它赋值为string.Empty?