手机
当前位置:查字典教程网 >编程开发 >asp.net教程 >ASP.NET(C#)中遍历所有控件
ASP.NET(C#)中遍历所有控件
摘要:复制代码代码如下:for(inti=0;i

复制代码 代码如下:

for (int i = 0; i < this.Controls.Count; i++)

{

foreach (System.Web.UI.Control control in this.Controls[i].Controls)

{

if (control is TextBox)

(control as TextBox).Text = "";

}

}

foreach (Control cl in this.Page.FindControl("Form1").Controls)

{

if (cl.GetType().ToString() == "System.Web.UI.WebControls.TextBox")

{

((TextBox)cl).Text = "";

}

}

【ASP.NET(C#)中遍历所有控件】相关文章:

ASP.NET MVC中将控制器分离到类库的实现

在ASP.NET中实现多文件上传的方法

ASP.NET编程中的十大技巧

ASP.NET入门教程:HTML服务器控件

在ASP.NET中调用存储过程方法新解

ASP.Net 分页控件源码

ASP.NET 页面中加添加用户控件的写法

浅谈ASP.NET中最简单的自定义控件

ASP.NET(C#)将数据导出到Word或Excel

ASP.NET2.0中数据源控件之异步数据访问

精品推荐
分类导航